smichaelsen/confengine

编辑器友好的配置模块

安装: 166

依赖: 0

建议者: 0

安全性: 0

星标: 7

关注者: 3

分支: 1

开放性问题: 1

类型:typo3-cms-extension

2.0.0 2017-08-15 12:09 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:42:11 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文件上传字段。