Typo3 override backend classes - class

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.

Related

TYPO3 EXT:cart_product: extend backend with one selection to do conditional theming in template

I'm looking for a way to extend the backend of the TYPO3 extension cart_products with one additional select field. I have already created some different ViewHelpers for the ProductBackendVariants and now need a way to choose the corresponding Viewhelper.
Best would be if there is a selection direct after the type select in the general product type. But I am not able to add some additional configuration fields to this tab.
Already added
'formtemplate' => [
'label' => 'ProductDetail Variant Form',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['Standard', 1],
['Matten', 2],
['Zaunpaket', 3],
],
'size' => 1,
'minitems' => 1,
'maxitems' => 1,
],
],
to the tx_cartproducts_domain_model_product_product.php but nothing appears in the backend.
I don't know that specific extension but some hints in general:
it seems that you have tried to modified the TCA directly in the extension (cart_products/Configuration/TCA/tx_cartproducts_domain_model_product_product.php). You should never change anything in a 3rd party extension (neither the TYPO3 core) because you loose the ability to update.
You need to create your own extension and add a file to Configuration/TCA/Overrides. Ideally you name the file exactly like the file you like to extend for easier understanding. See the documentation for details.
To add a new field to the TCA you not only need to define the name and type but you also need to create the database field. That's done in ext_tables.sql of your custom extension.
It's not sufficent to create the TCA config and SQL mentioned above you also need to tell, where the new field should be visible in the backend. That's done with the showitem setting. See documentation for details.
To ease the process of extending an existing TCA I can recommend the extension TCA Builder which makes it in many cases much easier to create the TCA code. See these examples how that's done. Nevertheless you need to create ext_tables.sql.
Last but not least: when you made changes to ext_tables.sql you need to run the database compare in the TYPO3 install tool.

Flex Relate field value is blank in List of Sub Panel

There are two modules: Customer & Top Transaction
Relationship between them: 1(Customer):Many(Top Transaction)
There is one 'Flex Relate' field in Top Transaction module.
Now I want to display that 'Flex Relate' value on sub panel list of Top Transaction module.
For that I did changes from studio->Customer->Sub-Panel->Top Transaction.
On Customer detail page under Top Transaction sub panel it's showing only header of 'Flex Relate' field & no value(values are blank).
Does anyone know solution to this?
I'm using 6.5 community edition.
Please check this link for flex relate Flex relate
Try to use relate field instead of flex related i think it will solve your problem .
I know, this is the old question, but here is the solution I have found.
Add these 2 fields in the subpanel metadata and this would show the parent/flex field properly.
However there is still an issue in that, here the target module is fixed. I will update this as soon as I find any solution to it.
Untill that, I think this is achievable in process_record hook. But, I am looking for some generic solution.
'parent_type' =>
array(
'usage' => 'query_only',
),
'parent_name' =>
array(
'width' => '10%',
'vname' => 'LBL_FLEX_RELATE',
'id' => 'parent_id',
'link' => true,
'widget_class' => 'SubPanelDetailViewLink',
'target_module' => 'AOS_Invoices',
'target_record_key' => 'parent_id',
'default' => false,
),

TinyMCE in impresspages plugin trouble

At first, it is need to know I get active the FullTinyMCe and TinyMCEComplete plugins in Impresspages. Well, I have a new plugin where I have a field like this:
$fields[] = array(
'label' => 'Rich Text to Store',
'field' => 'textToStore',
'type' => 'RichText',
'preview' => '\Plugin\MyPlugin\Helper::previewText'
);
How do I do to force the type RichText using the versatility of the FullTinyMCE instead of internal configuration? I need other skills in this field like html edit and save for instance.
Thanks for the aid!
These plugins alter the config just for themselves. If you want to update TinyMCE globally, change the implementation of ipTinyMceConfig() function. This is the default function that provides the configuration of TinyMCE. Replace it with your own function (this is all about JavaScript) that returns your custom configuration. That will take affect everywhere on ImpressPages. More about that:
https://www.impresspages.org/docs/tinymce

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

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'
)
)
)
),

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/