smichaelsen/settings

User friendly configuration module for editors

Installs: 214

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 3

Forks: 1

Open Issues: 1

Type:typo3-cms-extension

2.0.0 2017-08-15 12:09 UTC

This package is auto-updated.

Last update: 2024-11-29 05:20:51 UTC


README

Build Status

Because you haven't enough places in TYPO3 to configure stuff, right?

What it does

settings offers a new backend module in which extensions can offer configuration options. Why? Ever since I was missing a spot where editors (non-admins) can do global configuration.

Screenshot

How to use

Define fields:

Define your fields in TCA syntax and add it to the table tx_settings_form.

Example (in Configuration/TCA/Overrides/tx_settings_form.php):

<?php
if (!defined('TYPO3_MODE')) {
    die ('Access denied.');
}

$GLOBALS['TCA']['tx_settings_form']['columns'] = array_merge(
    $GLOBALS['TCA']['tx_settings_form']['columns'],
    [
        'tx_myext_myfield' => [
            'label' => 'My field',
            'config' => [
                'type' => 'input',
            ],
        ],
    ]
);
 
 
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
    'tx_settings_form',
    'tx_myext_myfield'
);

Read configuration

1. TypoScript

All configured values are available as TypoScript constants in plugin.tx_settings.

2. Fluid ViewHelper

{namespace s=Smichaelsen\Settings\ViewHelpers}
{s:getValue(name:'tx_myext_myfield')} or <s:getValue name="tx_myext_myfield"/>

and to load FAL resources:

<s:loadFalResources field="tx_myext_logo" as="logos">
  <f:image image="{logos.0}"/>
</s:loadFalResources>

3. PHP

You can also access the values via PHP:

$configurationService = GeneralUtility::makeInstance(\Smichaelsen\Settings\Service\ConfigurationService::class);
$allConfiguration = $configurationService->getAllConfiguration($GLOBALS['TSFE']->rootLine[0]['uid']);

Known issues

Inline fields do not work yet, that includes FAL file upload fields.