Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Format documentation and fix a few bugs #2360

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Documentation/Tutorials/BestPractice/BreadcrumbMenu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ You can use code like the following in your sites Fluid template.
.. code-block:: html

<div class="container">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<f:for each="{breadcrumbMenu}" as="item" iteration="iterator">
<li class="breadcrumb-item ">
<a href="{item.link}" title="{item.title}">
<f:if condition="{item.isNews}"><i class="fas fa-newspaper"></i></f:if>
{item.title}
</a>
</li>
</f:for>
</ol>
</nav>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<f:for each="{breadcrumbMenu}" as="item" iteration="iterator">
<li class="breadcrumb-item ">
<a href="{item.link}" title="{item.title}">
<f:if condition="{item.isNews}"><i class="fas fa-newspaper"></i></f:if>
{item.title}
</a>
</li>
</f:for>
</ol>
</nav>
</div>

The result (using Bootstrap 5 and Fontawesome 5 Free) could use like this:
Expand Down Expand Up @@ -161,11 +161,11 @@ you can continue to use it and add the news record to it.
source.intval = 1
conf.tx_news_domain_model_news = TEXT
conf.tx_news_domain_model_news {
field = title
field = title
htmlSpecialChars = 1
}
stdWrap.wrap = <li>|</li>
stdWrap.required = 1
stdWrap.wrap = <li>|</li>
stdWrap.required = 1
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Usage

10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
as = breadcrumbMenu
special = rootline
# [...] further configuration
as = breadcrumbMenu
special = rootline
# [...] further configuration
}
20 = GeorgRinger\News\DataProcessing\AddNewsToMenuProcessor
20.menus = breadcrumbMenu,specialMenu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Usage

10 = TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor
10 {
as = languageMenu
addQueryString = 1
as = languageMenu
addQueryString = 1
}

11 = GeorgRinger\News\DataProcessing\DisableLanguageMenuProcessor
11 {
if.isTrue.data = GP:tx_news_pi1|news
menus = languageMenu
if.isTrue.data = GP:tx_news_pi1|news
menus = languageMenu
}

The property :typoscript:`menus` is a comma-separated list of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ your own selections by adding those to

.. code-block:: php

$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['templateLayouts']['myext'] = array('My Title', 'my value');
$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['templateLayouts']['myext'] = ['My Title', 'my value'];

You can then access the variable in your template with
:code:`{settings.templateLayout}` and use it for a condition or whatever.
Expand Down
138 changes: 58 additions & 80 deletions Documentation/Tutorials/ExtendNews/ExtensionBasedOnNews/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ As a demonstration, a new extension with the extension key ``news_filter`` will
ext_emconf.php
^^^^^^^^^^^^^^

This file containts the basic information about its extension like name, version, author...
This file contains the basic information about its extension like name, version, author...

.. code-block:: php

Expand All @@ -31,18 +31,10 @@ This file containts the basic information about its extension like name, version
'category' => 'fe',
'author' => 'John Doe',
'author_email' => '[email protected]',
'shy' => '',
'dependencies' => '',
'conflicts' => '',
'priority' => '',
'module' => '',
'author_company' => '',
'state' => 'stable',
'internal' => '',
'uploadfolder' => 0,
'modify_tables' => '',
'clearCacheOnLoad' => 1,
'lockType' => '',
'author_company' => '',
'version' => '1.0.0',
'constraints' => [
'depends' => [
Expand All @@ -51,7 +43,6 @@ This file containts the basic information about its extension like name, version
'conflicts' => [],
'suggests' => [],
],
'suggests' => [],
];

ext_localconf.php
Expand All @@ -65,13 +56,13 @@ Create a basic plugin with one action called ``list``.
defined('TYPO3') or die();

$boot = function () {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'GeorgRinger.news_filter',
'Filter',
[
'Filter' => 'list',
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'NewsFilter',
'Filter',
[
\GeorgRinger\NewsFilter\Controller\FilterController::class => 'list',
]
);
};

$boot();
Expand All @@ -91,7 +82,7 @@ Register the plugin:
* Plugin
*/
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'news_filter',
'NewsFilter',
'Filter',
'Some demo'
);
Expand All @@ -110,35 +101,33 @@ Create a basic controller with the mentioned action.
namespace GeorgRinger\NewsFilter\Controller;

use GeorgRinger\News\Domain\Model\Dto\NewsDemand;
use GeorgRinger\News\Domain\Repository\NewsRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class FilterController extends ActionController
{

public function listAction()
{
$demand = $this->createDemandObject();
$this->view->assignMultiple([
'news' => $this->newsRepository->findDemanded($demand)
]);
}

/**
* @return NewsDemand
*/
protected function createDemandObject()
{
$demand = new NewsDemand();
$demand->setLimit(10);

return $demand;
}

/**
* @var \GeorgRinger\News\Domain\Repository\NewsRepository
* @inject
*/
protected $newsRepository;
protected NewsRepository $newsRepository;

public function __construct(NewsRepository $newsRepository)
{
$this->newsRepository = $newsRepository;
}

public function listAction()
{
$demand = $this->createDemandObject();
$this->view->assignMultiple([
'news' => $this->newsRepository->findDemanded($demand)
]);
}

protected function createDemandObject(): NewsDemand
{
$demand = new NewsDemand();
$demand->setLimit(10);

return $demand;
}
}

Resources/Private/Templates/Filter/List.html
Expand Down Expand Up @@ -176,7 +165,7 @@ After enabling the extension in the Extension Manager and creating a plugin "Fil

"autoload": {
"psr-4": {
"GeorgRinger\\NewsFilter\\": "typo3conf/ext/news_filter/Classes/"
"GeorgRinger\\NewsFilter\\": "path/to/news_filter/Classes/"
}
}

Expand All @@ -196,10 +185,7 @@ By modifying the controller with the following code, you will change the output

.. code-block:: php

/**
* @return NewsDemand
*/
protected function createDemandObject()
protected function createDemandObject(): NewsDemand
{
$demand = new NewsDemand();
$demand->setStoragePage('123');
Expand All @@ -212,7 +198,7 @@ By modifying the controller with the following code, you will change the output
Use FlexForms
^^^^^^^^^^^^^

Flexforms are a powerful tool to let editors configure plugins.
FlexForms are a powerful tool to let editors configure plugins.

Configuration/TCA/Overrides/tt_content.php
""""""""""""""""""""""""""""""""""""""""""
Expand Down Expand Up @@ -249,32 +235,27 @@ The syntax of ``FlexForms`` is identical to the one of ``TCA`` with the only dif
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:flexforms_tab.settings
</sheetTitle>
</TCEforms>
<sheetTitle>LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:flexforms_tab.settings</sheetTitle>
<type>array</type>
<el>
<settings.startingpoint>
<TCEforms>
<label>LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<config>
<type>group</type>
<allowed>pages</allowed>
<size>3</size>
<maxitems>50</maxitems>
<minitems>0</minitems>
<wizards>
<suggest>
<type>suggest</type>
<default>
<searchWholePhrase>1</searchWholePhrase>
</default>
</suggest>
</wizards>
</config>
</TCEforms>
</settings.startingpoint>
<settings.startingPoint>
<label>LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.startingPoint</label>
<config>
<type>group</type>
<allowed>pages</allowed>
<size>3</size>
<maxitems>50</maxitems>
<minitems>0</minitems>
<wizards>
<suggest>
<type>suggest</type>
<default>
<searchWholePhrase>1</searchWholePhrase>
</default>
</suggest>
</wizards>
</config>
</settings.startingPoint>
</el>
</ROOT>
</sDEF>
Expand All @@ -295,14 +276,11 @@ Adopt the controller to use the settings instead of the hardcoded ones.

.. code-block:: php

/**
* @return NewsDemand
*/
protected function createDemandObject()
protected function createDemandObject(): NewsDemand
{
$demand = new NewsDemand();
// Because of the naming "<settings.startingpoint>", you can use $this->settings['startingpoint']
$demand->setStoragePage($this->settings['startingpoint']);
// Because of the naming "<settings.startingPoint>", you can use $this->settings['startingPoint']
$demand->setStoragePage($this->settings['startingPoint']);
$demand->setLimit(10);

return $demand;
Expand Down
53 changes: 28 additions & 25 deletions Documentation/Tutorials/ExtendNews/Hooks/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ First, register your implementation in the file ``ext_localconf.php``:
defined('TYPO3') or die();

$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Domain/Repository/AbstractDemandedRepository.php']['findDemanded'][$_EXTKEY]
= 'YourVendor\\Extkey\\Hooks\\Repository->modify';
= \YourVendor\Extkey\Hooks\Repository::class . '->modify';

Now create the file ``Classes/Hooks/Repository.php``:

Expand All @@ -48,22 +48,24 @@ Now create the file ``Classes/Hooks/Repository.php``:
use TYPO3\CMS\Core\Utility\GeneralUtility;
use \GeorgRinger\News\Domain\Repository\NewsRepository;

class Repository {

public function modify(array $params, NewsRepository $newsRepository) {
$this->updateConstraints($params['demand'], $params['respectEnableFields'], $params['query'], $params['constraints']);
}

/**
* @param \GeorgRinger\News\Domain\Model\Dto\NewsDemand $demand
* @param bool $respectEnableFields
* @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
* @param array $constraints
*/
protected function updateConstraints($demand, $respectEnableFields, \TYPO3\CMS\Extbase\Persistence\QueryInterface $query, array &$constraints) {
$subject = 'yeah';
$constraints[] = $query->like('title', '%' . $subject . '%');
}
class Repository
{
public function modify(array $params, NewsRepository $newsRepository)
{
$this->updateConstraints($params['demand'], $params['respectEnableFields'], $params['query'], $params['constraints']);
}

/**
* @param \GeorgRinger\News\Domain\Model\Dto\NewsDemand $demand
* @param bool $respectEnableFields
* @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
* @param array $constraints
*/
protected function updateConstraints($demand, $respectEnableFields, \TYPO3\CMS\Extbase\Persistence\QueryInterface $query, array &$constraints)
{
$subject = 'yeah';
$constraints[] = $query->like('title', '%' . $subject . '%');
}
}

.. hint:: Please change the vendor and extension key to your real life code.
Expand All @@ -84,7 +86,7 @@ First, register your implementation in the file ``ext_localconf.php``:
defined('TYPO3') or die();

$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Controller/NewsController.php']['overrideSettings'][$_EXTKEY]
= 'YourVendor\\Extkey\\Hooks\\NewsControllerSettings->modify';
= \YourVendor\Extkey\Hooks\NewsControllerSettings::class . '->modify';

Now create the file ``Classes/Hooks/NewsControllerSettings.php``:

Expand All @@ -94,14 +96,15 @@ Now create the file ``Classes/Hooks/NewsControllerSettings.php``:

namespace YourVendor\Extkey\Hooks;

class NewsControllerSettings {
class NewsControllerSettings
{
public function modify(array $params)
{
$settings = $params['originalSettings'];
$settings['categories'] = '2,3';

public function modify(array $params) {
$settings = $params['originalSettings'];
$settings['categories'] = '2,3';

return $settings;
}
return $settings;
}
}

.. hint:: Please change the vendor and extension key to your real life code.
Expand Down
Loading
Loading