TYPO3: How to use disablePrependAtCopy in combination with allowLanguageSynchronization? - typo3

My question refers to the default "assets"-TCA-field. For the assets-field allowLanguageSynchronization is set to 'true' and disablePrependAtCopy for sys_file_reference is active.
This configuration works as expected when the content element is translated for the first time. [Translate to XY] is not visible in the translated content element.
However, when I add another image to the content element for sys-lang 0 after the initial translation, [Translate to XY] is visible for sys-lang 1.
(Click image to enlarge)
How can I stop TYPO3 from adding [Translate to XY] to the metadata fields?
Configuration:
Version: TYPO3 9.5.5
'allowLanguageSynchronization' is set to true:
$GLOBALS['TCA']['tt_content']['columns']['assets']['config']['behaviour']['allowLanguageSynchronization'] = true;
I also disabledPrependAtCopy for assets:
TCEMAIN.table.sys_file_reference {
disablePrependAtCopy = 1
}
What I tried:
For sys-lang 0: Add image to a content element which uses the assets field (e.g. text-media).
Add metadata for image (e.g. title).
Translate content element to sys_lang 1 ([Translate to XY] is not visible as expected).
Go back to sys-lang 0: add a second image to content element and save the changes.
Switch to sys-lang 1: metadata of new file now contains [Translate to XY] -> How can I prevent that?

You need another TCEMAIN setting here.
Try the following code
TCEMAIN {
translateToMessage =
}
if this does not work, maybe you can disable it by this code
TCEMAIN {
translateToMessage >
}

The issue is still not fixed. https://forge.typo3.org/issues/87887 is connected to TYPO3 v9, however changes in v10 were made. Even those changes do not work..
However, I was able to walk around the problem by unset the l10n_mode of the fields alternative, description and title.
Default it is set to prefixLangTitle and exclude would remove the field in the translations completely.
Therefore, unset (or probably set it to empty or an invalid value) does not add the prefix.

Related

How to remove a field from `showitems` in TCA?

TYPO3 has the function TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes() to add or replace one or more fields to the BE form of a record.
How can we remove fields?
(replacing by '' does not work)
Explanation:
Its about hiding some fields in tt_content for some CTypes only.
In the past we did it by overwriting the complete value. But with the upgrade from 6.2LTS to 8LTS we run into problems as the default labels have changed (pathes to the language files) and so some labels become lost in the BE, which was noticed very late.
Now I want a clean way to remove single fields so that the definition of the remaining fields stays clean with the default values from core (or other extensions).
Other extensiosn which add their own fields also are a problem if the value is set with a static string: these fields are also removed.
Since there is indeed no way to insert an empty string, you could create an empty palette instead. This way you will still get a non empty string to insert, but it will not create any output in the form.
addToAllTCAtypes('table', '--palette--;;empty', '', 'replace:fieldname')
And you should make a feature request, to make at least the replacement with an empty string possible in upcoming versions of TYPO3.
Do it in the code like this:
foreach ($GLOBALS['TCA']['yourtablenamehere']['types'] as &$definition) {
$definition['showitems'] = '';
}
if you only need to reset a specific type ('0', for example):
$GLOBALS['TCA']['yourtablenamehere']['types']['0']['showitems'] = '';
If you want to override types completely instead of clearing them (clearing only does not much sense anyway):
$GLOBALS['TCA']['yourtablenamehere']['types']['0']['showitems'] = 'title, bodytext';

Localization do not work when "l18parent" is empty (0)

When a content element is translated using "translate" method and so have a l18parent, the content shows up in frontend.
When using "copy" method or created the content in new language without l18parent the content do not appear in frontend.
Can simply test it when unselecting a l18parent in CE form and selecting a parent again.
See screenshots attached.
With parent, working.
Without parent, not working (not appearing in frontend).
Not working
Working
Since TYPO3 6.2 there is a new setting for the CONTENT object: includeRecordsWithoutDefaultTranslation
see here: https://docs.typo3.org/typo3cms/TyposcriptReference/6.2/Functions/Select/
Before this, the CONTENT object fetched all elements.
After this change, only elements which were correctly translated in the backend with the translation buttons, are displayed, because they have a parent.
Maybe you can check with these settings in your typoscript (at the beginning of your typoscript):
styles.content.get.select.includeRecordsWithoutDefaultTranslation = 1
styles.content.getLeft.select.includeRecordsWithoutDefaultTranslation = 1
styles.content.getRight.select.includeRecordsWithoutDefaultTranslation = 1
Then all elements should show up again; even the ones without parent.
Original resource for this is written in german here:
http://blog.teamgeist-medien.de/2014/08/typo3-content-anzeige-von-uebersetzungen-ohne-parent-bzw-default-translation.html

AEM DefaultValue written to JCR

I noticed that when I set my defaultValue for a dropdown, altho it is correctly selected in the drop down when I first add my component to the page it does not write the defaultValue to the corresponding JCR until I edit the component and save it. Even if I just open the corresponding dialog and click OK now my component works as expected because the values have been added to the JCR.
I am sure there is an important piece that I am missing here, does anyone knows how defaultValues that are required in order for the component to render properly can be added to the JCR when they are first added to the page?
Like Shwan say's that's the way it works. The default values or empty texts are only for the dialog. They aren't persisted until the dialog is authored. The properties have to be set by a different method. CQ already ships with this feature and you can do it without any custom code.
Under your component , create a node called cq:template[nt:unstructured] . If all the data is stored on the component node itself , add the default values as properties to cq:template node with name same as the ones in your dialog. In case the data is stored in a child node add a similar node under cq:template node.
Source : http://blogs.adobe.com/experiencedelivers/experience-management/defaults-in-your-component/
I believe that is simply the way it works. The default value specified in a dialog does not get used until the dialog is loaded/saved, so until that happens the node on the JCR repository that is being authored won't have the default value.
We got around this on a project by adding back-end code that was tied to the component (a tag) so that when the component was loaded, if the property did not exist, it would be written with the default the first time. Ex:
if (wcmMode == WCMMode.EDIT )
{
if(!currentNode.hasProperty("SomePropertyThatWillAlwaysExistIfTheDialogHasBeenSaved")) {
currentNode.setProperty("PropertyThatShouldHaveDefault", GlobalConstants.TRUE);
currentNode.getSession().save();
}
}
Like Sharath Madappa say's that's the way it works fine if component name and jsp name same. If you dont have componentname.jsp under component or page, cq:template won't work.(Reference:http://labs.6dglobal.com/blog/2014-07-08/using-the-cq-template/)
If you hava componentname.html under your component, changed the node [cq:template] type to [cq:Template] instead of [nt:unstructured]. In this case, defaultValues can be added to the JCR when they are first added to the page.

Cannot add a third content field

I'm kinda new to typo, so maybe I am just missing something.
I'm trying to add a third content field to Typo3 4.5.
What I've done so far.
Edit my template and added a new block
Added the block via TemplatVoila > Update Mapping > Modify DS / TO with Element Preset "Page-Content Elements [Pos.: 0]
Mapped it to the new block in the template
But I am missing something as the new field isn't showing up in the Page edit screen.
EDIT: I've found the Block in the "Edit page properties" but how to show it on standard edit screen?
Any added content area will appear automatically in your TV-View-module. So if you dont see it in there, then
you may have duplicate fields names
wrong column positions
or the existing template is using a »beLayout«-section, which shows only the first two content areas (see example in reference http://docs.typo3.org/typo3cms/extensions/templavoila/ExtTemplavoila/StaticDataStructures/ExampleForBelayout/Index.html)
The TemplaVoila template is split into TS (TemplaVoilà Template Object) and DS (TemplaVoilà Data Structure) records, may you paste the content of the field „Data Structure XML“ of the DS record here? In there are all necessary information.
The two template files should be located in your general storage folder, your TypoScript root file should be there as well.

TYPO3 Extension Manager: Button "Only display updatable extensions" is not displayed

If I open the extension manager, switch to the tab Import Extensions and select the filter I get the following options:
Display all extensions (empty)
Only display installed extensions (working)
There should also be a Only display updatable extensions selection but this isn't displayed. What is the reason therefore?
I made a TYPO3 update to 4.7.2 and perhaps thats the reason why it isn't correctly displayed?
The repository is up to date.
The filter has been moved from the Import Extensions to the Available Extensions tab.
You do not actually want to import an extension, but update an existing one.
Just suggestion: I had similar issues with button displaying in EM before (4.6.x) (ie. Install ext button) and realised, that the button is available, but sprite image had wrong position which caused that the button was transparent,
Try to use ie FireBug to check it, and eventually fix the CSS (and report the bug)
Edit:
Some doom apparently, I just had identical situation just seconds ago ;) Fortunately found the reason: the ext list is displayed with ExtJS grid, which can contain custom filtering per column. Literally: when you for an example click on the column's dropdown arrow, you can in its filter set some value to narrow the search results.
Ie.: in the main filter field write news and additionally in the Extension Key column set other filter tt_news. (if you want to display only %tt_news% in result list of %news%)
In that case even if you'll clear the main filter, the one set on the column will stay active, so next time when you'll try to search for realurl in main filter, it will return empty list as Extension Key filter is still set to tt_news.
Weeeird, however helped me :)
You can recognize filtered columns as their names are written with cursive, finally you can just check every column and disable any filtering on each.