I used extension builder to set up my frist extension. Except for the translation and everything works very well.
You can bind an element to an language but not the other way round. What I would like to do is, to create all needed elements in the default language and then create translations based on (some) of these elements, like you do in Typo3 Web-View. It's important that there is some kind of connection/relation between the defaulr element and its translations to make a fallback to the default language possible.
Is this possible? Or do I need to create multiple fields for all element properties (for all langs expected so far) in each element?
Update/Solution
It seems as if the desired function is already implemented (just a bit hidden).
First you need to create a new Element in default language. Next you create a second new Element and save it as the desired language in which you need to extend the first Element. If you reopen the second one a new select field shows up, where you can choose the lang-parent. Save it again an you'll have the connection.
Do we talk about Fluid extensions?
If so you have a translation tool:
<f:translate key="list_nonewsfound" />
And to translate this u have to create a file in /Resources/Private/Language/locallang.xml
<T3locallang>
<meta type="array">
<type>database</type>
<description>Language labels for database tables/fields belonging to extension 'news'</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="list_nonewsfound">No news available.</label>
</languageKey>
<languageKey index="da" type="array">
<label index="list_nonewsfound">Ingen tilgængelige nyheder.</label>
</languageKey>
</data>
</T3locallang>
(Example taken from tx_news)
More information (german link): http://docs.typo3.org/typo3cms/ExtbaseGuide/Fluid/ViewHelper/Translate.html
(english link): http://wiki.typo3.org/Fluid#f:translate
Related
I have a TYPO3 plugin with a FlexForm. In the FlexForm I added relations to a foreign table. I now need to disable some of the fields of the foreign table. I can't do this via user rights since it's a question of context, not rights.
My FlexForm looks like this:
<settings.moreinfo>
<TCEforms>
<label>my label</label>
<config>
<type>inline</type>
<foreign_table>tx_foo_domain_model_bar</foreign_table>
<foreign_field>content_uid</foreign_field>
<foreign_sortby>sorting</foreign_sortby>
<maxitems>50</maxitems>
</config>
</TCEforms>
</settings.moreinfo>
I thought about TCEFORM, but have no idea how to address the field:
TCEFORM.tt_content.pi_flexform.foobar.general {
settings\.moreinfo {
# maybe here?
}
}
Is there any possibility to disable a field via TSconfig or PHP?
in general you could disable flexform fields. the manual states the possibility:
Other properties also apply to flex form fields, in this case the full property path including the data structure key has to be set:
TCEFORM.[tableName].[fieldName].[dataStructureKey].[flexSheet].[flexFieldName].[propertyName].
The [dataStructKey] represents the key of a FlexForm in
$GLOBALS['TCA'][<tableName>]['columns'][<field>]['config']['ds']. This
key will be split into up to two parts. By default the first part will
be used as identifier of the FlexForm in TSconfig. The second part
will override the identifier if it is not empty, list or *.
For example the identifier of the key my_ext_pi1,list will be my_ext_pi1
and of the key *,my_CType it will be my_CType. See section Pointing to
a data structure of the TCA reference for details.
Some properties apply to whole FlexForm sheets, their property path is
TCEFORM.[tableName].[fieldName].[dataStructureKey].[flexSheet].[propertyName].
it could be problematic if you use . inside of identifiers.
This answer to a different question inspired me to the solution which finally solved my problem!
foreign_types was the solution I was looking for:
<settings.moreinfo>
<TCEforms>
<label>my label</label>
<config>
<type>inline</type>
<foreign_table>tx_foo_domain_model_bar</foreign_table>
<foreign_field>content_uid</foreign_field>
<foreign_sortby>sorting</foreign_sortby>
<maxitems>50</maxitems>
<foreign_types type="array">
<numIndex index="1" type="array">
<showitem>
title, link, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, hidden;;1, starttime, endtime
</showitem>
</numIndex>
</foreign_types>
</config>
</TCEforms>
</settings.moreinfo>
I need a rush course on News (and some TYPO3). I would like to have a further 'what to display' plugin option, to show a customized list of news.
I (believe to) understand how to define a new mylistAction method within class newsController, and a corresponding mylist.html template.
What I miss is how I get a (working) mylist option within the BE module to insert the plugin into a page.
I am not sure what else I need to update and how (TCA, language files, TS, ... )
Thanks for your help, Cheers, mario
----- EDIT and SOLVED
I made it!
i defined action listmAction() within NewsController.php
i defined template listm.html
within Configuration/Flexforms/flexform_news.xml i added lines:
<numIndex index="22">
<numIndex index="0">LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:flexforms_general.mode.news_listm
</numIndex>
<numIndex index="1">News->listm</numIndex>
</numIndex>
within locallang_be.xlf i added lines
<trans-unit id="flexforms_general.mode.news_listm" xml:space="preserve">
<source>List m view</source>
</trans-unit>
Now i am able to insert a News plugin into a page with the
new listm option, and the listm template is rendered. (It seems I needed to trash cache too). Good!
It's a bad idea to modify the news extension - you can't really update it afterwards.
However, EXT:news has a built in way to add multiple list views, documented here.
Short version: There is a template selector in the news plugin, and you can add items to it through TypoScript. Put something like this in your pageTS:
tx_news.templateLayouts {
1 = A custom layout
99 = LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:flexforms_general.mode.news_listm
}
The choice you make in the backend in this field is passed to the views in the variable settings.templateLayout.
So in your List.html template file you can do this:
<f:if condition="{settings.templateLayout} == 99">
<f:then>
<!-- Render template with number 99 here -->
</f:then>
<f:else>
<!-- Render template with number 1 here -->
</f:else>
</f:if>
If you have multiple templates, it would be a good idea to use the switch/case-ViewHelpers from EXT:vhs or something similar.
If you want to insert the plugin into a page you need create custom frontend plugin for it. Something like
ext_tables.php:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Namespace.' . $_EXTKEY,
'custom_news',
'Custom News'
);
ext_localconf.php:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Namespace.' . $_EXTKEY,
'custom_news',
array('CustomNews' => 'mylist'),
// non-cacheable actions
array('CustomNews' => 'mylist')
);
I hope you created custom extension for it and extended newsController.
Regards, Anton
Usually when renaming a flux field, the old values are not transfered and have to be entered again. Is there a way to keep the values after renaming a flux field?
Let's look at this simple flux configuration for example:
<f:section name="Configuration">
<flux:form id="article" icon="{f:uri.resource(path: 'Icons/Content/Example.svg')}" options="{group: 'FCE'}">
<flux:field.text name="text" rows="1"/>
</flux:form>
</f:section>
If I now rename the field text to title all previously entered values for text are lost:
<f:section name="Configuration">
<flux:form id="article" icon="{f:uri.resource(path: 'Icons/Content/Example.svg')}" options="{group: 'FCE'}">
<flux:field.text name="title" rows="1"/>
</flux:form>
</f:section>
Is it possible to somehow let flux know, that the field title is supposed to have the values of the former field text?
Short answer: no.
If I now rename the field text to title all previously entered values for text are lost
Long answer: in fact, they are still present in stored XML from FlexForm, but with old name. There are two reasons for this:
This is not technically possible to determine, that the field was
renamed. Because the end result is same, as field was deleted and a new was created.
Imagine a situation, that you have two page templates, where first one contains field of name text and second - title. You set first template as page template and fill text with something. Then you change template to second one - should now title contain previously filled value? Then you switch back to the first template - should the text be restored (in fact it is restored, because Flux doesn't delete it)? And now combine it with inheritance of templates and see, which mess can happen.
I have a feature which is provisioning 1 document library and 2 custom lists. A folder is included for each list containing the schema.xml for that list. Each folder also contains the associated forms (AllItems, DispForm, EditForm, NewForm, etc.). Everything deploys/works correctly but it seems a little redundant having the same forms copied into each list's folder. There is nothing special about these lists - the are basically a default doc library/generic list with additional fields provided through new content types (derived from Item/Document).
As far as I can tell these forms are pretty generic. Are there pre-installed forms that I can reference from my list so I don't have to deploy all of these extra files? Is there any reason I would not want to do this?
Update - moving xml in comment to original question for readability:
<Forms>
<Form Type="DisplayForm" Url="Forms/DispForm.aspx" WebPartZoneID="Main"/>
<Form Type="EditForm" Url="Forms/EditForm.aspx" WebPartZoneID="Main"/>
<Form Type="NewForm" Url="Forms/Upload.aspx" WebPartZoneID="Main"/>
<Form Type="NewFormDialog" Path="EditDlg.htm">
....
There are virtual defaults that are used if you don't specify a concrete page.
All lists use these template defaults unless you use a tool like SharePoint designer to customize the page. Then the template is used to create the concrete page and you can customize the look for a particular list without affecting others.
For my custom definitions, I use
<List>
...
<MetaData>
...
<Forms>
<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
</Forms>
</MetaData>
</List>
If you have no reason to customize the out of the box version of these forms, you can use the virtual form and not deploy copies.
I've added the following new Eclipse template via extension point. It simply adds a template for a sample testTag tag.
<!-- Add code template -->
<extension point="org.eclipse.ui.editors.templates">
<template autoinsert="true"
contextTypeId="html_tag"
description="[Description] Template populated by Snippet values ***"
id="org.eclipse.jst.jsf.ui.newHtmltag"
name="testTag">
<pattern>
<![CDATA[
<testTag style="background: ${color}"></testTag>
]]>
</pattern>
</template>
<resolver
contextTypeId="html_tag"
type="src"
class="TestTagTemplateVariableResolver">
</resolver>
</extension>
What I'd cannot figure out is how to change the value of the $(color) variable at runtime. More specifically, when the user presses Ctrl + Space (or the equivalent for content-assist) and types in "testTag" and presses Enter -- instead of the "color" placeholder text, I'd like it replaced by some other text value I have in another class. How do I do this?
This email chain from 2004 says it might not be possible:
the Java editor chooses not to respect resolvers contributed to its two context types ('java' and 'javadoc'), but only recognizes the built-in resolvers.
The html editor you are working with may have a similar restriction.