Skip to content
Snippets Groups Projects
Commit af08cee8 authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[TASK] Cleanup

parent 2669624a
No related branches found
No related tags found
No related merge requests found
Showing with 99 additions and 73 deletions
......@@ -24,6 +24,7 @@ namespace SGalinski\DfTabs\DataProvider;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException;
use TYPO3\CMS\Core\Database\ConnectionPool;
......@@ -50,12 +51,12 @@ abstract class AbstractDataBaseDataProvider extends AbstractBaseDataProvider {
protected $cachedRecord;
/**
* Returns the internally used record data
*
* @param int $uid
* @return array
* @throws AspectNotFoundException
*/
* Returns the internally used record data
*
* @param int $uid
* @return array
* @throws AspectNotFoundException
*/
protected function getRecordData($uid) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table);
$row = $queryBuilder->select('*')
......@@ -101,12 +102,12 @@ abstract class AbstractDataBaseDataProvider extends AbstractBaseDataProvider {
}
/**
* Returns the tab content for given tt_content identifiers
*
* @param int $uid
* @return string
* @throws ContentRenderingException
*/
* Returns the tab content for given tt_content identifiers
*
* @param int $uid
* @return string
* @throws ContentRenderingException
*/
public function getTabContent($uid) {
$configuration = [
'tables' => 'tt_content',
......@@ -114,7 +115,9 @@ abstract class AbstractDataBaseDataProvider extends AbstractBaseDataProvider {
'dontCheckPid' => 1
];
if (\array_key_exists('records.', $this->pluginConfiguration) && \is_array($this->pluginConfiguration['records.'])) {
if (\array_key_exists('records.', $this->pluginConfiguration) && \is_array(
$this->pluginConfiguration['records.']
)) {
$configuration = \array_merge($configuration, $this->pluginConfiguration['records.']);
}
......@@ -122,12 +125,12 @@ abstract class AbstractDataBaseDataProvider extends AbstractBaseDataProvider {
}
/**
* Returns the header field of the requested tt_content element
*
* @param int $uid
* @return string
* @throws AspectNotFoundException
*/
* Returns the header field of the requested tt_content element
*
* @param int $uid
* @return string
* @throws AspectNotFoundException
*/
public function getTitle($uid) {
if (!isset($this->cachedRecord[$uid])) {
$this->cachedRecord[$uid] = $this->getRecordData($uid);
......@@ -137,12 +140,12 @@ abstract class AbstractDataBaseDataProvider extends AbstractBaseDataProvider {
}
/**
* Returns the link data for this specific id
*
* @param int $uid
* @return string
* @throws AspectNotFoundException
*/
* Returns the link data for this specific id
*
* @param int $uid
* @return string
* @throws AspectNotFoundException
*/
public function getLinkData($uid) {
if (!isset($this->cachedRecord[$uid])) {
$this->cachedRecord[$uid] = $this->getRecordData($uid);
......
......@@ -37,11 +37,11 @@ final class FactoryDataProvider {
* Returns a table instance based upon the given type. The additional parameters are used
* to instantiate the table instance with needed information's.
*
* @throws GenericException if no valid data provider could be created
* @param string $type pages, tt_content ...
* @param array $pluginConfiguration
* @param ContentObjectRenderer $contentObject
* @return AbstractBaseDataProvider
* @throws GenericException if no valid data provider could be created
*/
public static function getDataProvider($type, array $pluginConfiguration, ContentObjectRenderer $contentObject) {
$dataProvider = NULL;
......
......@@ -40,9 +40,9 @@ interface InterfaceDataProvider {
/**
* Returns the tab content for this specific id
*
* @see getContentUids
* @param int $uid
* @return string
* @see getContentUids
*/
public function getTabContent($uid);
......
......@@ -85,7 +85,7 @@ class Tab {
* @return void
*/
public function setRecord($record) {
$this->record = (int)$record;
$this->record = (int) $record;
}
/**
......
......@@ -19,6 +19,7 @@ namespace SGalinski\DfTabs\Hooks\PageLayoutView;
* GNU General Public License for more details.
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\DfTabs\Preview\PreviewService;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\PageLayoutView;
......@@ -41,7 +42,6 @@ class PluginRenderer implements PageLayoutViewDrawItemHookInterface {
$this->previewService = GeneralUtility::makeInstance(PreviewService::class);
}
/**
* @inheritDoc
* @noinspection ReferencingObjectsInspection
......@@ -74,9 +74,9 @@ class PluginRenderer implements PageLayoutViewDrawItemHookInterface {
*/
protected function adaptPluginHeaderContent(?string &$headerContent, array $row): void {
$headerContent = '<h4>' . $this->getPluginNameForHeaderContent(
(int) $row['pid'],
$row['list_type']
) . $headerContent . '</h4>';
(int) $row['pid'],
$row['list_type']
) . $headerContent . '</h4>';
}
/**
......
......@@ -21,11 +21,8 @@
namespace SGalinski\DfTabs\Preview;
use TYPO3\CMS\Backend\Preview\PreviewRendererInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
/**
*
......@@ -72,7 +69,6 @@ class PreviewRenderer implements PreviewRendererInterface {
return $this->previewService->getPluginView($item->getRecord())->render();
}
/**
* Render a footer for the record to display in page module below
* the body of the item's preview.
......
......@@ -17,6 +17,7 @@
* GNU General Public License for more details.
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
namespace SGalinski\DfTabs\Preview;
use TYPO3\CMS\Backend\Utility\BackendUtility;
......@@ -46,7 +47,9 @@ class PreviewService {
'T3DataStructure'
)['data']['sDEF']['lDEF'];
$tabElements = GeneralUtility::trimExplode(',', $this->passVDefOnKeyToTemplate($pluginConfiguration, 'data'), TRUE);
$tabElements = GeneralUtility::trimExplode(
',', $this->passVDefOnKeyToTemplate($pluginConfiguration, 'data'), TRUE
);
$tabs = [];
foreach ($tabElements as $tabElement) {
......
......@@ -67,15 +67,15 @@ class ConfigurationService {
);
if (isset($configuration['autoPlayInterval'])) {
$configuration['autoPlayInterval'] = (int)$configuration['autoPlayInterval'];
$configuration['autoPlayInterval'] = (int) $configuration['autoPlayInterval'];
}
if (isset($configuration['pollingInterval'])) {
$configuration['pollingInterval'] = (int)$configuration['pollingInterval'];
$configuration['pollingInterval'] = (int) $configuration['pollingInterval'];
}
if (isset($configuration['animationSpeed'])) {
$configuration['animationSpeed'] = (int)$configuration['animationSpeed'];
$configuration['animationSpeed'] = (int) $configuration['animationSpeed'];
}
return $configuration;
......@@ -136,7 +136,7 @@ class ConfigurationService {
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'autoPlayInterval'));
if ($value !== '') {
$configuration['autoPlayInterval'] = (int)$value;
$configuration['autoPlayInterval'] = (int) $value;
}
// this has to be a try catch for now, since animationSpeed was never a Setting inside of our flexform.
// when the Plugin has not been updated, this will stay, throwing an error in php8+
......
......@@ -24,6 +24,7 @@ namespace SGalinski\DfTabs\View;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
......@@ -43,6 +44,7 @@ class FluidView implements SingletonInterface {
/**
* FluidView constructor.
*
* @param array $settings
*/
public function __construct(array $settings = []) {
......
......@@ -11,6 +11,7 @@ mod {
}
}
}
show = *
}
}
......@@ -37,9 +37,11 @@ plugin.tx_dftabs_plugin1 {
templateRootPaths {
10 = {$plugin.tx_dftabs_plugin1.view.templateRootPath}
}
partialRootPaths {
10 = {$plugin.tx_dftabs_plugin1.view.partialRootPath}
}
layoutRootPaths {
10 = {$plugin.tx_dftabs_plugin1.view.layoutRootPath}
}
......
# Ext: df_tabs
# Ext: df_tabs
<img src="https://www.sgalinski.de/typo3conf/ext/project_theme/Resources/Public/Images/logo.svg" />
......@@ -10,17 +10,21 @@ Please report bugs here: https://gitlab.sgalinski.de/typo3/df_tabs
## About
This extension adds a new plugin to the content element wizard that provides the user the possibility to define other content elements and pages as tab based content.
This extension adds a new plugin to the content element wizard that provides the user the possibility to define other
content elements and pages as tab based content.
Furthermore, you can define an auto-play mechanism with a custom interval to implement an auto-sliding effect.
## Installation
1. Install the extension with the extension manager
2. Add the static template of the extension to your template of your root page, or your extension root templates
3. Download and include the MooTools Core or JQuery (If your project already has MooTools or JQuery included, skip this step)
3. Download and include the MooTools Core or JQuery (If your project already has MooTools or JQuery included, skip this
step)
4. Implement your custom css code and override the include configuration option in the constants of the very same template with the integration of the static template from df_tabs
4. Implement your custom css code and override the include configuration option in the constants of the very same
template with the integration of the static template from df_tabs
## Usage
......@@ -28,7 +32,8 @@ Furthermore, you can define an auto-play mechanism with a custom interval to imp
#### Fluid Renderer
The output can be completely controlled from within the Fluid-Template `(EXT:df_tabs/Resources/Private/Templates/Standard/Tabs.html)`.
The output can be completely controlled from within the
Fluid-Template `(EXT:df_tabs/Resources/Private/Templates/Standard/Tabs.html)`.
Just overwrite it to adjust it to your needs.
##### TypoScript Constants
......@@ -139,6 +144,7 @@ tt_content {
```
#### Output customization
There are various settings in the **setup.txt** TypoScript file, which allow you to customize the output beyond css.
```typoscript
......@@ -178,17 +184,21 @@ stdWrap {
##### Mode
###### Show Content Elements
Retrieves the tab contents from the tt_content table.
###### Show Pages
Retrieves the tab contents from the pages table.
###### Combined
Use the tt_content and the pages table to retrieve the content
---
##### Pages and content
Here you can select pages or single content elements, that should be displayed in a tab:
<img height="20px" width="20px" src="https://raw.githubusercontent.com/TYPO3/TYPO3.Icons/master/src/apps/apps-pagetree-page-hideinmenu.svg"> Opens the "Select Page" dialog
......@@ -198,27 +208,33 @@ Here you can select pages or single content elements, that should be displayed i
---
##### Override Tab Titles
Here you can specify a linebreak separated list of preferred menu titles.
---
##### Enable Autoplay
If this setting is enabled, the tabs will automatically be switched through in a given time interval.
---
##### Autoplay Interval
Sets the time interval for the autoplay option. Is ignored if autoplay is disabled.
---
##### Enable MouseOver Navigation
If this setting is enabled, the tab will switch on the mouse over event instead of clicking.
---
##### Hash
Name that is displayed as the prefix of the anchor for the url if a tab was clicked to implement the history and direct linking functionality to the tabs.
Name that is displayed as the prefix of the anchor for the url if a tab was clicked to implement the history and direct
linking functionality to the tabs.
## Styles
......@@ -228,5 +244,6 @@ sass Resources/Public/Sass/df_tabs.scss Resources/Public/StyleSheets/df_tabs.css
## JavaScript
Starting from 8.1.0 there will be a fully functional JavaScript file loaded to the frontend which does **not** require any additional libraries.
Starting from 8.1.0 there will be a fully functional JavaScript file loaded to the frontend which does **not** require
any additional libraries.
The JavaScript file can be disabled by emptying out the typoscript variable ```plugin.tx_dftabs_plugin1.js.dftabs```.
{
"name": "sgalinski/df-tabs",
"type": "typo3-cms-extension",
"description": "Tabbed Content and Pages - Create tab based content elements and pages easily and flexible with configurable mouseover handling, animations and autoplay features! It requires jquery.",
"homepage": "https://www.sgalinski.de",
"license": ["GPL-2.0-or-later"],
"version": "8.1.4",
"support": {
"issues": "https://gitlab.sgalinski.de/typo3/df_tabs/issues"
},
"require": {
"typo3/cms-core": "^10.4 || ^11.5"
},
"replace": {
"sgalinski/df_tabs": "self.version"
},
"extra": {
"typo3/cms": {
"extension-key": "df_tabs"
}
},
"autoload": {
"psr-4": {
"SGalinski\\DfTabs\\": "Classes/"
}
}
"name": "sgalinski/df-tabs",
"type": "typo3-cms-extension",
"description": "Tabbed Content and Pages - Create tab based content elements and pages easily and flexible with configurable mouseover handling, animations and autoplay features! It requires jquery.",
"homepage": "https://www.sgalinski.de",
"license": [
"GPL-2.0-or-later"
],
"version": "8.1.4",
"support": {
"issues": "https://gitlab.sgalinski.de/typo3/df_tabs/issues"
},
"require": {
"typo3/cms-core": "^10.4 || ^11.5"
},
"replace": {
"sgalinski/df_tabs": "self.version"
},
"extra": {
"typo3/cms": {
"extension-key": "df_tabs"
}
},
"autoload": {
"psr-4": {
"SGalinski\\DfTabs\\": "Classes/"
}
}
}
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment