A tt_content custom content element (imageslider) has IRRE slides.
The slide record has a title and an image (filereference).
Is it possible to preview the image of the IRRE record?
The previewRenderer class seems to be oriented only on the page view.
typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php shows a TCA setting for headerThumbnail
However this TCA doesn't produce the headerThumbnail.
'appearance' => [
'headerThumbnail' => [
'field' => 'image',
'width' => '45',
'height' => '45c',
],
So a userFunc or something is needed to retrieve the fileUid for field? Or is there an easier solution possible?
[EDIT] An IRRE record could of course have multiple images. So I guess this should be a feature for the InlineRecordContainer class, like the previewRenderer class to adjust the look and content.
Nice hint, that there should be custom thumbnails possible...
After diving a bit deeper in InlineRecordContainer, it seems to be clear, that this can't work (anymore?). There are (in v10/v11) the following lines:
// Renders a thumbnail for the header
if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && !empty($inlineConfig['appearance']['headerThumbnail']['field'])) {
$fieldValue = $rec[$inlineConfig['appearance']['headerThumbnail']['field']];
$fileUid = $fieldValue[0]['uid'];
For the UID of the thumbnail, the first array entry in the given field is used. But when debugging $rec (=$data['databaseRow']), we see, it is just the raw record, which means a FAL-field will not be an array but only an integer that counts the relations...
IMO this is a bug. I have just reported it: https://forge.typo3.org/issues/96188
Related
In tt_content I have added something like this, and set the core icon 'content-image':
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
[
'My Element',
'myelement',
'content-image'
],
'textmedia',
'after'
);
And this works in the 'Type' dropdown menu. However, when in Page or List view it always shows the default text icon. How do I change this to match the type menu?
Just found another question with a real good answer - mainly the same
as mine, but better structured - have a look:
How to setup icons for content elements or plugins in a TYPO3 extension
You may revisit https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentElements/AddingYourOwnContentElements.html with a full overview.
The \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem() registers the icon only for the select field.
For the "new content element" wizard you have to provide a proper TSconfig part https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentElements/AddingYourOwnContentElements.html#add-it-to-the-new-content-element-wizard
// example - you must adopt for your element
mod.wizards.newContentElement.wizardItems {
// add the content element to the tab "common"
common {
elements {
examples_newcontentelement {
iconIdentifier = content-text
title = LLL:EXT:examples/Resources/Private/Language/locallang.xlf:examples_newcontentelement_title
description = LLL:EXT:examples/Resources/Private/Language/locallang.xlf:examples_newcontentelement_description
tt_content_defValues {
CType = examples_newcontentelement
}
}
}
show := addToList(examples_newcontentelement)
}
}
If you want to use a custom image, you have to register it. Either in ext_localconf.php with proper icon calls or depending on the core version with the simple Configuration/Icons.php file.
See for 11.5+ https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Icon/Index.html or before see https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Icon/Index.html
The next part is then TCA configuration for the specific table. Generic table icon file is configured with:
// or $GLOBALS if done as TCA Override for a existing table
return [
// ...
'ctrl' => [
'iconFile' => '',
// ...
],
// ...
https://docs.typo3.org/m/typo3/reference-tca/main/en-us/Ctrl/Properties/Iconfile.html
Table with types can have different icons per types, which can be set with typeicon_classes
https://docs.typo3.org/m/typo3/reference-tca/main/en-us/Ctrl/Properties/TypeiconClasses.html#ctrl-reference-typeicon-classes - however, this depends on the type field. For tt_content this is "CType". So this helps only for real content elements which registeres as own CType - and not as list CType with a subtype list_type. For extbase plugin this is done with the proper plugin registration in Configuration/TCA/Overrides/tt_content.php:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'ExtkeyInCamelCase',
'PluginIdentifier',
'plugin title',
// icon
'my-icon');
In that in studio I have created some fields in one module and i also add those fields in Layout. but i want to display the fields according to the selection, for example: if user select option-1 from dropdown field then it has to display say only three field, and if user select option-2 from dropdown field then it has to display say six fields. so i need to add some condition in the layout field. but i can't find any option there.. please help me to find out.
i also attached the example image below.
If you are using sugar 7.6 I can help,
You want to change the fields according to drop down values if i am not wrong .
For that you have to right a code in "record.js" and "create-actions.js" files . just write a js function.
This is an example for crerate-action.js
({
extendsFrom: 'CreateActionsView',
initialize: function (options) {
this.model.on("change:dropdown", this.renderFields, this);
},
renderFields: function () {
// write your code here
},
})
You need to modify the view definitions to add a script into the edit view of your module.
Example:
$viewdefs ['<Module Name>'] =
array(
'<View Name>View' =>
array(
'templateMeta' =>
array(
...
'includes' =>
array(
0 =>
array(
'file' => 'path/to/your/script.js',
),
1 =>
array(
'file' => 'path/to/your/script.js',
),
),
...
),
...
),
...
);
You then can use jQuery or any javascript library to hide or show the fields. if you are using SuiteR or SuiteP theme you can simply add/remove the hidden class to the elements.
Just make sure that you add all the fields into your view which you wish to show or hide.
To make this upgrade save modify or create
custom/modules/module name/metadata/editviewdefs.php for the edit view
custom/modules/module name/metadata/detailviewdefs.php for the detail view
There are many defined ways in sugarcrm, as you have created new fields, all you need to add dependencies on those fields like
$dictionary['YOUR_MODULE_NAME']['fields']['YOUR_FIELD_NAME']['dependency']='(equal($YOUR_DROPDOWN,"OPTION_1"))
see
http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.7/Architecture/Sugar_Logic/Dependency_Actions/SetVisibility/#Visibility_Dependencies_in_Field_Definitions
This can also be added through Studio.
Go to Studio > module > fields > YOUR_FIELD > Dependent and add dependency.
How to display form item label in Views exposed form instead of '- Any -'? To be more specific I use this code to replace select's default value text with custom text and want that custom text to be the label of that element:
function THEMENAME_form_views_exposed_form_alter(&$form, &$form_state) {
//dpm($form);
if ($form['#id'] == 'views-exposed-form-FORMID') {
$form['ITEMNAME']['#options']['All'] = t('My custom translatable text');
}
}
This works for custom text. What I want is to display its label instead of My custom translatable text with the simple code like:
$form['ITEMNAME']['#options']['All'] = $form['ITEMNAME']['#name'];
but have no luck on such and similar codes to work. According fo $dpm($form) output '#name', '#title' elements seem not to exist at all.
The goal is to have similar functionality of https://drupal.org/project/compact_forms or https://drupal.org/project/In-Field-Labels without another Javascript library (prefer to use couple PHP lines, please no JS solutions)
Your above code will work in case of select field but not for text field. If you need it to work for text fields you can try this
$form['ITEMNAME']['#attributes'] = array('placeholder' => array('My custom translatable text'));
or
$form['ITEMNAME']['#attributes'] = array('placeholder' =>$form['ITEMNAME']['#name']);
hope this helps you
I have one large .xhtml file consisting of many chapters. There are div tags with e.g. id="article2" on some of them. I am now trying to make an ebook out of it. EBook::EPUB is a nice package that helps greatly.
And I have most of it working well. Alas, the following does not work:
for (my $cnt=1; $cnt<=$#chapters; ++$cnt) {
$epub->add_navpoint(
label => 'Chapter '.$cnt.": $memotitles[$cnt]",
id => 'article'.$cnt,
content => 'text.xhtml',
play_order => $cnt );
}
When I open the epub file in iBooks, it shows me the labels, but clicking on any of them does not move me to the right page in the epub file.
I know that it is possible to get ids from a book where each chapter is its own .xhtml file. alas, is it possible to get ids to reference waypoints (chapters) from inside the same .xhtml file? Or do I really have to break my large .xhtml file into many smaller ones?
Advice appreciated.
"content" property should have id of the element in the xhtml page. So something like this should work:
for (my $cnt=1; $cnt<=$#chapters; ++$cnt) {
$epub->add_navpoint(
label => 'Chapter '.$cnt.": $memotitles[$cnt]",
id => 'article'.$cnt,
content => 'text.xhtml#article' . $cnt,
play_order => $cnt );
}
By default typo3 Back end layout give Normal,Left,Right and Border.
To hide the blocks i used following code
mod.SHARED.colPos_list = 0,1,2
How to rename the blocks in Typo script:
Normal - Description
Left- News
Right - Publications
Border - Footer
When inserting the following in the Page TSConfig of the root page, the values of the dropdown "Columns" are changed when editing content elements:
TCEFORM.tt_content.colPos.altLabels {
0 = News
1 = Description
2 = Publications
3 = Footer
}
Unfortunately, this is only halfway :(
According to Spalten ändern und umbenennen you'll need to edit typo3conf/extTables.php which affects all pages in the tree:
t3lib_extMgm::addPageTSConfig('
mod.SHARED.colPos_list = 0,1,2,3
');
$TCA["tt_content"]["columns"]["colPos"]["config"]["items"] = array (
"1" => array ("News||||||||||","1"),
"0" => array ("Description||||||||||","0"),
"3" => array ("Publications||||||||||","3"),
"2" => array ("Footer||||||||||","2"),
);
If you're using TYPO3 4.5+, you can use the new feature called backend layout or grid view.
It is very easy to use. You don't have to edit PHP-code. You just have to configure it using a wizard.
Joey Hasenau has written a good article at news.typo3.org about how to use the backend layout.
I hope, this facilitates your daily work!