smichaelsen/settings

用户友好的配置模块,适用于编辑器

安装: 214

依赖者: 0

建议者: 0

安全: 0

星星: 7

观察者: 3

分支: 1

开放性问题: 1

类型:typo3-cms-extension

2.0.0 2017-08-15 12:09 UTC

This package is auto-updated.

Last update: 2024-08-29 04:37:04 UTC


README

Build Status

因为你没有足够的TYPO3配置位置,对吧?

它做什么

settings提供了一个新的后端模块,其中扩展可以提供配置选项。为什么?自从我缺少一个让编辑器(非管理员)可以进行全局配置的地方以来。

Screenshot

如何使用

定义字段

使用TCA语法定义你的字段,并将其添加到表tx_settings_form中。

示例(在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'
);

读取配置

1. TypoScript

所有配置的值都以TypoScript常量的形式在plugin.tx_settings中可用。

2. Fluid ViewHelper

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

以及加载FAL资源

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

3. PHP

您还可以通过PHP访问这些值。

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

已知问题

内联字段目前无法使用,包括FAL文件上传字段。