TYPO3 modify backend table - typo3

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.

Related

Laravel backpack Customized fields are not working for Edit and Update methods

I'm using backpack in my project. I’ve created a customized fields that is dropdown and select box. In one blade file I’m displaying two fields based on dropdown selection I’ll display the options for select box. So everything is working fine somehow Edit and update is working for these customized field. any idea how to achieve this? Thanks in advance
In one blade file I've written these two customized fields code. so based on dropdown selection I'll pull up the options for next select box. Tried to override existed backpack files for this model. but no luck.
'label' => "Professors",
'type' => "selectProfessors",
'name' => 'professor_id',
'entity' => 'professor',
'attribute' => "name",
'model' => Professor::class,
'options' => (function ($query) {
return $query->where('professor_id', '=', backpack_user()
->professor_id)
->get();
}),
It is not working only for edit and update. for creating and deleting working as expected.

How to pass params in url to a backpack create form

I'm using backpack 3.3 on a laravel 5.5 installation.
I want to prefill two create form fields with two URL passed values.
Say you create a basic backpack crud, named Image.
Normally you can go to domain/admin/image/create to view and fill in the form.
But if I add one or two params in the url, I get a 404.
I guess I should manage the routes file (admin.php)
I tried this way:
Route::group(['prefix' => 'image/{k}/{cid}'], function()
{
CRUD::resource('image', 'ImageCrudController');
});
but still get a 404.
Any suggestions?
Thanks in advance.
Almost all field types have a default option. So when you define them, you can specify a default. And you can always pass a GET parameter for that default. So you can have something like this in your EntityCrudController:
$this->crud->addField[ // Text
'name' => 'title',
'label' => "Title",
'type' => 'text',
'default' => \Request::has('title')?\Request::has('title'):false, // default value
]);
You'd then be able to send you users to yourapp/admin/entity/create?title=your+default+value and have that default value show up in the field.
Hope it helps. Cheers!
it works for me easier
http://127.0.0.1:8000/admin/resultado/create?competencia=2
$this->crud->modifyField("competencia_id",[
'label' => "Competencia",
"default"=>$this->crud->request->query->get('competencia'),
.....

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

Additional page property fields in TYPO3 CMS 6.2

What would be the recommended method to add custom page property fields in TYPO3 6.2?
In 4.5 I used TemplaVoila which had its own page module and made it easy to add data records on a page level.
There are several approaches:
The "vanilla" approach:
Create an extension (and with it the file ext_emconf.php) and then create a file ext_tables.sql in the extension root. In it you can put SQL-definitions for the new fields, by defining a CREATE TABLE statement for the pages table:
CREATE TABLE pages(
myNewField int(11) DEFAULT '',
);
This SQL-definition will be merged with existing definitions for the table page.
Then you need to configure the new field in the Table Configuration Array (TCA). You can usually find good examples in existing extensions, for example in realurl. There are two places where you can put these definitions, either in the file ext_tables.php (uncached), or into a php file in the folder Configuration/Tca/Overrides (cached).
This approach sounds like more work than it actually is.
Just use TemplaVoila. It is available for TYPO3 6.2, but its future is uncertain, AFAIK.
Use the fluidtypo3-Ecosystem of extensions, and especially the extension fluidpages. It does what you want, in a similar way to TemplaVoila, but with modern (= fluid-based) technologies.
if you need your own custom content elements, i recommend the extension "DCE" (Dynamic Content Elements).
DCE is really easy to customise and you can create Content elements in some minutes.
Also you can do it like Jost said. Do it with an own extension and put the TCA definition in your extTables.php
As example:
/www/htdocs/website/typo3conf/ext/custom_extension/ext_tables.php
$tmp_itm_extended_columns_pages = array(
'link_class' => array(
'exclude' => 0,
'label' => 'LLL:EXT:itm_extended/Resources/Private/Language/locallang_db.xlf:label.linkClass',
'config' => array(
'type' => 'select',
'items' => array(
array('Nichts', ''),
array('Zahnrad', 'icon-afford', 'EXT:custom_extension/Resources/Public/img/icons/icon_preferences_small.png'),
array('Fabrik', 'icon-factory', 'EXT:custom_extension/Resources/Public/img/icons/icon_factory_small.png'),
array('Computer', 'icon-software', 'EXT:custom_extension/Resources/Public/img/icons/icon_software_small.png'),
array('Person', 'icon-jobs', 'EXT:custom_extension/Resources/Public/img/icons/icon_person_small.png'),
array('Welt', 'icon-world', 'EXT:custom_extension/Resources/Public/img/icons/icon_world_small.png'),
array('Rohre', 'icon-pipe', 'EXT:custom_extension/Resources/Public/img/icons/icon_pipe_small.png'),
),
),
),
);
Then you have to add your new field to the ext_tables.sql
#
# Table structure for table 'pages'
#
CREATE TABLE pages (
link_class text
);

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/