I have created a FlexForm for my typo3 backend to choose some options:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>
</sheetTitle>
</TCEforms>
<el>
<settings.maxNumber>
<TCEforms>
...
<settings.orderBy>
<TCEforms>
<label>My selections</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items>
<numIndex index="0">
<numIndex index="0">Title first</numIndex>
<numIndex index="1">title,year,author</numIndex>
</numIndex>
<numIndex index="1">
<numIndex index="0">Year first</numIndex>
<numIndex index="1">year,title,author</numIndex>
</numIndex>
<numIndex index="2">
<numIndex index="0">Author first</numIndex>
<numIndex index="1">author,year,title</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</settings.orderBy>
<!-- end of settings -->
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
My problem is that the first entries in the dropdown menu in the backend are
1. [INVALID VALUE ("author")][author]
2. [INVALID VALUE ("title")][title]
3. [INVALID VALUE ("year")][year]
then the other options follow as expected.
Documentation about "items" array in "select" type about the second value says:
Values must not contain “,” (comma) and “|” (vertical bar). If you want to use “authMode” you should also refrain from using “:” (colon).
https://docs.typo3.org/m/typo3/reference-tca/9.5/en-us/ColumnsConfig/Type/Select.html#items
It means you should probably use a different separator for those values to avoid the issue you're facing.
Related
In general you use flexforms to offer custom TYPO3 plugin settings. So I've setup the following lines in my ext_tables.php:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'DS.Dscontrolpanel',
'Dsentitymodullist',
'Entitymodullist'
);
// ...
// Flexform
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dscontrolpanel_entitymodullist'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dscontrolpanel_entitymodullist','FILE:EXT:dscontrolpanel/Configuration/FlexForms/flexform_dscontrolpanel.xml');
and start a little test flexform just to test it (flexform_dscontrolpanel.xml):
<T3DataStructure>
<ROOT>
<TCEforms>
<sheetTitle>Test 1</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<test>
<TCEforms>
<label>Test 2</label>
<config>
<default>1</default>
<type>check</type>
<items type="array">
<numIndex index="1" type="array">
<numIndex index="0">enabled</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</test>
</el>
</ROOT>
After that I cleared both the TYPO3 cache and the PHP opcode cache. But nothing happens in my FE Plugin form. Is there a new way in TYPO3 7.6+ to add custom settings to TYPO3 FE plugins or do I just miss something?
I think you have build wrong the plugin siganture.
dscontrolpanel_dsentitymodullist instead of dscontrolpanel_entitymodullist
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'DS.Dscontrolpanel',
'Dsentitymodullist',
'Entitymodullist'
);
// ...
// Flexform vv
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dscontrolpanel_dsentitymodullist'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
// vv
'dscontrolpanel_dsentitymodullist',
'FILE:EXT:dscontrolpanel/Configuration/FlexForms/flexform_dscontrolpanel.xml'
);
Why don't you just register a frontend plugin? Then it will automatically generate a flexform for you, which you can extend, plus it will give you this by default
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $extKey . '/Configuration/FlexForms/flexform_your_extension.xml');
I will not change my first answer, but apparently i was wrong. Follow these steps and you ll be able to add your FlexForm:
Just in case
$pluginSignature = str_replace('_', '', $extKey) . '_yourextensionKey';
Register your FlexForm:
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
Find your FlexForm:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $extKey . '/Configuration/FlexForms/FlexFormNameHere.xml');
I have a TYPO3 frontend plugin and now I want two different ways to display the "list" controller. How can I achieve this?
You need to use flexform for frontend plugin like below.
In your ext_tables.php file.
//extenstion name
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
//plugin integration
$frontendpluginName = 'Plugin name';
$pluginSignature = strtolower($extensionName) . '_'.strtolower(
$frontendpluginName
);
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
$pluginSignature,
'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/configure.xml'
);
Now create configure.xml file on this path /Configuration/FlexForms/
<T3DataStructure>
<sheets>
<!--
################################
SHEET General Settings
################################
-->
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>General</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<!-- View -->
<settings.layout>
<TCEforms>
<label>Select Frontend Layout</label>
<config>
<type>select</type>
<items>
<numIndex index="0">
<numIndex index="0">Layout 1</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
<numIndex index="1">
<numIndex index="0">Layout 2</numIndex>
<numIndex index="1">2</numIndex>
</numIndex>
</items>
<size>10</size>
<minitems>0</minitems>
<maxitems>1</maxitems>
<suppress_icons>1</suppress_icons>
</config>
</TCEforms>
</settings.layout>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
Now use this value in frontend template files like below.
<f:if condition="{settings.layout} == 1">
<f:then>
Layout 1 html
</f:then>
<f:else>
Layout 2 html
</f:else>
</f:if>
I haven't used this in a while so I am not 100% this is still relevant, the API docs suggest that you can still do this though:
public function listAction() {
{your_code}
$this->view->setTemplatePathAndFilename(
'typo3conf/ext/' .
$this->request->getControllerExtensionKey() .
'/{path_to}/OtherTemplate.html');
$this->view->assign(...);
}
If you need to switch this on a per plugin base decide which template to use by reading a configuration variable.
I'm trying to update a custom field with a file type using rest API.
After properly uploading a file using:
curl --data-binary "#test.pdf" -H "Content-Type: application/octet-stream" -X POST -H "X-Redmine-API-Key: e1d815b8963e7b3950d4bea47959f874be755a2c" https://redmine-dev/uploads.xml
I get my token:
<?xml version="1.0" encoding="UTF-8"?>
<upload>
<id>15</id>
<token>15.cb4...</token>
</upload>
And then I tried to update the custom filed using those and none worked:
<?xml version="1.0"?>
<issue>
<custom_fields type="array">
<custom_field id="4">
<token>15.cb4...</token>
<filename>test.pdf</filename>
</custom_field>
</custom_fields>
</issue>
<?xml version="1.0"?>
<issue>
<custom_fields type="array">
<custom_field id="4">
<value>
<token>15.cb4...</token>
<filename>test.pdf</filename>
</value>
</custom_field>
</custom_fields>
</issue>
<?xml version="1.0"?>
<issue>
<custom_fields type="array">
<custom_field id="4">
<value>15</value>
</custom_field>
</custom_fields>
</issue>
After each the field is cleared in the database.
Updating a different custom field (text and number based) alongside of each of those is working. I've also checked the docs and there is nothing detailing how to use REST to update custom attachments.
It was so easy after looking into the code, but the token has to belong to previously unused attachment.
<?xml version="1.0"?>
<issue>
<custom_fields type="array">
<custom_field id="4">
<value>
<token>15.cb4...</token>
</value>
</custom_field>
</custom_fields>
</issue>
In Sulu cmf demo there is a sctionb where i can add multiple blocks.
I'd like to use this as "Pagebuilder".
I thought this block in my pages/default.xml will do the trick (and I think it is).
Do I need to clear any cache for this to work, or what am I missing?
<section name="content">
<meta>
<title lang="de">Inhalt</title>
<title lang="en">Content</title>
<info_text lang="de">Bereich für den Inhalt</info_text>
<info_text lang="en">Content Section</info_text>
</meta>
<properties>
<property name="article" type="text_editor" mandatory="true">
<meta>
<title lang="de">Artikel</title>
<title lang="en">Article</title>
</meta>
</property>
<block name="block"
default-type="editor"
minOccurs="2"
maxOccurs="10"
mandatory="true">
<meta>
<title lang="de">Block</title>
<title lang="en">Block</title>
</meta>
<types>
<type name="editor">
<meta>
<title lang="de">Texteditor</title>
<title lang="en">Text editor</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Titel</title>
<title lang="en">Title</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
<property name="article" type="text_editor" mandatory="true">
<meta>
<title lang="de">Artikel</title>
<title lang="en">Article</title>
</meta>
</property>
</properties>
</type>
<type name="textarea">
<meta>
<title lang="de">Texteingabe</title>
<title lang="en">Text area</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Titel</title>
<title lang="en">Title</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
<property name="article" type="text_area" mandatory="true">
<meta>
<title lang="de">Artikel</title>
<title lang="en">Article</title>
</meta>
</property>
</properties>
</type>
<type name="title_only">
<meta>
<title lang="de">Nur Titel</title>
<title lang="en">Title Only</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Titel</title>
<title lang="en">Title</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
</properties>
</type>
</types>
</block>
<property name="name" type="text_line" mandatory="false" minOccurs="2" maxOccurs="5">
<meta>
<title lang="de">Name</title>
<title lang="en">Name</title>
</meta>
</property>
</properties>
</section>
<property name="links" type="internal_links">
<meta>
<title lang="de">Verknüpfungen</title>
<title lang="en">Internal links</title>
</meta>
</property>
</properties>
If you do changes in a template file you need to clear the cache with the default symfony command:
app/console cache:clear
EDIT
Did test it Daniel Rotter is right on dev you don't need to clear the cache. Just refresh the page and it should show your changes.
Okay, after i logged off and signed in again, it works like expected.
I am using log4j2 to log to the console and file as in this xml file
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - Line %L: %msg%n}"/>
</Console>
<File name="MyFile" fileName="all.log" immediateFlush="true" append="false">
<PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - Line %L: %msg%n"/>
</File>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console" level="error"/>
<AppenderRef ref="MyFile" level="info"/>
</Root>
</Loggers>
</Configuration>
The problem is only the first line in the netbeans console appears in red while the remaining lines are black as in the following picture.
Any help will be appreciated
Update:I tried the project with eclipse and all lines appeared in black