TYPO3 TCA/Flexform Link Wizard: How to display page name in the backend? - typo3

I created a custom content element using a fluid template for the frontend and a flexform xml file for the backend. The element has a link input field that makes use of the link wizard as explained in this question:
How can i make a Link input Field in TCA
This works fine, but when I select a page from the page tree in the wizard, the input field displays the page ID (for example a "4"). If I use the same (?) wizard within content elements that vanilla TYPO3 provides (for example the "shortcut" page type), the backend shows the name of the page in the link input field, not the ID.
Is there an easy way to bring that functionality to my own element?
Remark: In my case, I don't use the PHP array writing style, but the XML one. So what would be 'config' => array(...) in the PHP array is ... in my XML Flexform.

This is standard behavior, see for an example Link field under the Header it also uses uid of the page, reason is simple: it allows to choose a page, but also external URL, email address or file reference - therefore it doesn't use page's title but its uid.
Second sample - shortcut to page definitely allows you to store only pages records, so it can render its title on the list - but doesn't allow you to mix different kinds of links.
If your ext will store always one type of link (ie. references to pages) you can use TCA field of type Group as showed in documentation
'storage_pid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_tca.xlf:storage_pid',
'config' => array(
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'size' => '1',
'maxitems' => '1',
'minitems' => '0',
'show_thumbs' => '1',
'wizards' => array(
'suggest' => array(
'type' => 'suggest'
)
)
)
),

Related

Change the backend-view of mask - TYPO3

I try - in TYPO3 8.7.13 with the extension mask 3.1.0 - to build for example a CE with repeating records with fields for names - no problem.
But in the backend I can see only the first field. Is there any way to show both?
https://www.dropbox.com/s/rmsg5qfd51blhrf/mask1.png?dl=0
So there are preview templates they belong to the page view and not edit.
In edit mode you only see the label (this is given in the definition of IRRE in the TYPO3 core).
So you only can change the shown 'label' of the record. That means: using label_alt in the TCA (I recommend to use label_alt_force too):
'ctrl' => [
'label' => 'surname',
'label_alt' => 'givenname,surname',
'label_alt_force' => 1,
],

Typo3 override backend classes

It's been a few weeks I work on Typo3 6.2 and I want to know how to override Typo3 Core classes.
In my case, I have to edit the way select html objects are displayed (I want to add optgroup but Typo doesn't allow us to do it). So I edited the file "FormEngine.php" (typo3/sysext/backend/Classes/Form) and now it works.
But this isn't healthy for future upgrade.
Is there a way to override core classes like any other CMS would allow us to do ?
And I haven't been able to find something on the Internet and I think it could be useful.
Thank you :)
Zisiztypo
Instead of modifying source code of CMS you can just declare a field with a user type and then point your custom userFunc
From the ref:
'tx_examples_special' => array (
'exclude' => 0,
'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:fe_users.tx_examples_special',
'config' => array (
'type' => 'user',
'size' => '30',
'userFunc' => 'Documentation\\Examples\\Userfuncs\\Tca->specialField',
'parameters' => array(
'color' => 'blue'
)
)
),
TIP: Using this approach, you can create ANY type of field you need, it can be i.e. Google Maps selector, set of fields with common dependencies filled by JS, etc, etc.

CakePHP Forms, where to find and how to modify?

I'm currently new to cakephp and I just want to ask how can I accomplish this,
a select box in which I'm the one determining its options,
<?php echo $this->Form->input('treat', array('class' => 'form-control')); ?>
or how can I trace the code above to know where in the MVC did he determine his options for his selectbox. tnx
#SOS as suggested by #ndm read up on the Form Helper.
There are generally two ways to pass the options to a select via the Form Helper.
First if you have baked the application the contents of the select could be in the DB.
The Form Helper recognizes Model associations and builds the forms accordingly.Thus the contents of the select should be in the DB. For example if you have User belongsTo/hasOne UserType, the userTypes select will be populated from the DB table for userTypes.
The other way is as was already said, but unclear:
one can directly pass the options parameter of the Form->input() function.
There is another function that creates selects via the FormHelper: select().
Check it here
You can use the below code to define the options -
<?php echo $this->Form->input('treat', array(
'class' => 'form-control',
'type' => 'select',
'options' => array(
'1' => 'option 1',
'2' => 'option 2'
)
)); ?>
Just specify the options in the options array. you can also specify the blank option in that by writing 'empty'=>'Please Select' in the array list.

TYPO3 modify backend table

EDIT: TYPO3 version 4.7
there is table Create Website user with many tabs.
I am able to add new tab with my own data using:
$test = array(
'tx_promconf_send_email' => array(
'exclude' => 0,
'label' => 'HAHAHA',
'config' => array(
'type' => 'input'
,)));
t3lib_div::loadTCA('fe_users');
t3lib_extMgm::addTCAcolumns('fe_users',$test,1);
t3lib_extMgm::addToAllTCAtypes('fe_users','--div--;Documents;;;;1-1-1,tx_promconf_send_email');
But I am not able to put my input to already existing tabs. Also I was not able to find some explanation of this string 'fe_users','--div--;Documents;;;;1-1-1,tx_promconf_send_email'.
Is there an option how to modify existing tabs? Where can I found the name of the tab? I tried to use instead of --div-- name of the tab and it does not work.
This weird string is hardly documented. You can find the TCA Documentation here.
If you want to insert it to an existing tab, just do it by finding a field within the desired tab where you want to put your new field after or before.
For example:
t3lib_extMgm::addToAllTCAtypes('fe_users','tx_promconf_send_email', '', 'after:last_name');
Your field will now be displayed after the field "last_name", and so within the tab "Personal Data". You can also use "before:fieldname" to insert your field before a field.

Add a dropdown list as custom field in magento

I added custom fields as described in magento add custom input field to customer account form in admin
But I want a select list, not only a text input one. I don't know which kind of parameter I have to set and how to tell the list of possible values.
Please help :)
Thanks,
Plantex
Where you might do something like:
$setup->addAttribute('customer', 'custom_attribute', array(
'type' => 'text',
'label' => 'Customer Custom Attribute',
));
Use these values instead:
$setup->addAttribute('customer', 'custom_attribute', array(
'type' => 'int',
'label' => 'Customer Custom Attribute',
'input' => 'select',
'source' => 'eav/entity_attribute_source_boolean',
));
The type is int because you will typically be storing the index of the value chosen, not the value itself. The input is select so the admin renderer knows which control to use. The source shown here is a common example, it provides an array of "Yes" and "No" values with numeric indexes.
There are many source models already in the Magento code that you can use and you can create your own too, look at any existing one to see how it returns an array. If you make your own and if it uses text indexes instead of numeric then the type will have to be changed back to text.
Try adding this at your module setup file
'value' => array('notate_to_zero'=>array(0=>'Bleu',0=>'Rouge',0=>'Vert',0=>'Violet',0=>'Noir',0=>'Orange'))
),
or look at this --> http://inchoo.net/ecommerce/magento/how-to-create-custom-attribute-source-type/