how to pre-fill select box in typo3 backend - php

First of all excuse my bad english.
I got a problem with my select-field in the BE. I would like to prefill (preselect) all of the available items.
Code in ext_tables.php:
'teilnehmer' => array(
'exclude' => 0,
'label' => 'LLL:EXT:kiwanisext/Resources/Private/Language/locallang_db.xlf:tx_kiwanisext_domain_model_veranstaltung.teilnehmer',
'config' => array(
'type' => 'select',
'foreign_table' => 'fe_users',
'MM' => 'tx_kiwanisext_veranstaltung_user_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 9999,
'multiple' => 0,
'wizards' => array(
'_PADDING' => 1,
'_VERTICAL' => 1,
'edit' => array(
'type' => 'popup',
'title' => 'Edit',
'script' => 'wizard_edit.php',
'icon' => 'edit2.gif',
'popup_onlyOpenIfSelected' => 1,
'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1',
),
'add' => Array(
'type' => 'script',
'title' => 'Create new',
'icon' => 'add.gif',
'params' => array(
'table' => 'fe_users',
'pid' => '###CURRENT_PID###',
'setValue' => 'prepend'
),
'script' => 'wizard_add.php',
),
),
),
),
I found nothing helpful in the documentation.
Any hint, tip or help will be much appreciated!

Its not possible to do that with plain TCA config, afaik. You can however define a default value wich will be selected (if none is defines, 1st item will be selected).
'default' => 'myValue'
But to preselect multiple values at once, you have to use JavaScript I guess.

This code worked for me in typo3 6.2. I have a selectbox filled with database records.
I want the records with ID's 1 ans 2 to be preselected in the selectbox:
'thematique' => array(
'exclude' => 0,
'label' => 'LLL:EXT:dk_actus/locallang_db.xml:tx_dkactus_thematique',
'config' => array(
'type' => 'select',
'foreign_table' => 'tx_dkactus_thematique',
'foreign_table_where' => 'ORDER BY tx_dkactus_thematique.uid',
'size' => 10,
'minitems' => 0,
'maxitems' => 99,
'default' => '1,2',
),
),

Related

wp Advance custom field - default choice depending on choice from another array

My users can select different kind of site headers, and there are three selects that combine with each other.
I have a "Full" and "Centered" header - when they select "Full" I want my other select to be "Gradient", but when they change to "Centered" I want the default to be "Light solid". I'm really not experienced in wordpress and advanced custom fields.
Here's my code:
if(function_exists("register_field_group"))
{
register_field_group(array (
'id' => 'acf_post-style',
'title' => __('Post style', 'crisp'),
'fields' => array (
array (
'key' => 'field_56a21897616b9',
'label' => __('Top image style', 'crisp'),
'name' => 'crisp_top_image',
'type' => 'select',
'required' => 1,
'choices' => array (
'centered' => 'Centered image',
'full' => 'Full screen image',
),
'default_value' => 'centered',
'allow_null' => 0,
'multiple' => 0,
),
array (
'key' => 'field_56a218f9616ba',
'label' => __('Header text background', 'crisp'),
'name' => 'crisp_text_bg',
'type' => 'select',
'required' => 1,
'choices' => array (
'light-solid' => 'Light solid background',
'light-transparent' => 'Transparent light backgrund',
'dark-transparent' => 'Transparent dark background',
'gradient' => 'Gradient background',
'none' => 'No background',
),
'default_value' => 'gradient', // I want this one to change
'allow_null' => 0,
'multiple' => 0,
),
Can I make a function that alters this? If so, how do I get these arrays?

How to show a grid / table in a tab section that will be displayed in in the admin section of prestashop 1.6.x

I want to show a grid or editable table in my tab in the admin section
I managed to do the module and three tabs are been displayed .In one of the tab i want to show a editable grid i.e in the CHECKS tab
As shown in the below image,in the chek tab section i want to show a grid
In the constructor of my admin controller of my module ()
ie in addhealthcheckconfig\controllers\admin\HealthCheckConfigController.php
I am setting the field options to populate the tab ,below is my code:
$this->fields_options = array(
'appearance' => array(
'title' => $this->l('Manage your Health Check '),
'icon' => 'icon-html5',
'tabs' => array(
'TAB1' => $this->l('SUPPORT_GROUPS'),
'TAB2' => $this->l('CHECKS'),
'TAB3' => $this->l('REPORT RECIPIENTS'),
),
'fields' => array(
'SUPPORT_GROUPS' => array(
'title' => $this->l('SUPPORT GROUPS'),
'hint' => $this->l('Manage your Support Groups here'),
'type' => 'fields_list',
'name' => 'PS_LOGO',
'tab' => 'TAB1'
),
'CHECKS' => array(
'title' => $this->l('LIST OF AVAILABLE CHECKS '),
'hint' => $this->l('List of Available checks will be displayed here !!'),
'type' => 'text',
'list' => $this->fields_list = array(
'code' => array(
'title' => $this->l('code'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
'description' => array(
'title' => $this->l('description'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
'category' => array(
'title' => $this->l('category'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
),
'tab' => 'TAB2'
),
'REPORT_RECIPIENTS' => array(
'title' => $this->l('REPORT RECIPIENTS '),
'hint' => $this->l('List of Available checks will be displayed here !!'),
'tab' => 'TAB3'
),
) ));
In the TAB2 Section i am not sure what i need to put in the 'type' section , I tried with list , but yet I can not achieve what I am trying to do , also i am not sure how to assign the $this->fields_list to that type correctly
How to achieve this editable db grid in my tab ?

Orange HRM 3.1 leave list customization

In orangehrm3.1 I want to customize view leave request page. If leave request day is greater than 3 I need to hide Actions list box for supervisor.
How do I do this?
Currently editing in LeaveListConfigurationFactory.php
$leaveRequestService = new LeaveRequestService();
$header7->populateFromArray(array(
'name' => 'Actions',
'width' => '10%',
'isSortable' => false,
'isExportable' => false,
'elementType' => 'leaveListAction',
'textAlignmentStyle' => 'left',
'elementProperty' => array(
'classPattern' => 'select_action quotaSelect',
'defaultOption' => array('label' => 'Select Action', 'value' => ''),
'hideIfEmpty' => true,
'options' => array($leaveRequestService, 'getLeaveRequestActions', array(self::RECORD, self::$loggedInEmpNumber)),
'namePattern' => 'select_leave_action_{id}',
'idPattern' => 'select_leave_action_{id}',
'hasHiddenField' => true,
'hiddenFieldName' => '{eimId}-{leaveTypeId}',
'hiddenFieldId' => '{eimId}-{leaveTypeId}',
'hiddenFieldValueGetter' => 'getNumberOfDays',
'hiddenFieldClass' => 'quotaHolder',
'placeholderGetters' => array(
'id' => 'getId',
'eimId' => 'getEmpNumber',
'leaveTypeId' => 'getLeaveTypeId'
),
),
));

TYPO3 suggest wizard, search in substring

I use the suggest wizard in TYPO3 backend.
The following code is in the tca:
'tx_db_colors' => array (
'exclude' => 0,
'label' => 'Farbe',
'config' => array (
"type" => "group",
"allowed" => "tx_db_colors",
"foreign_table" => "tx_db_colors",
"internal_type" => "db",
"size" => 1,
"minitems" => 0,
"maxitems" => 1,
'items' => array(array('', ''),),
'wizards' => array(
'suggest' => array(
'type' => 'suggest',
),
),
)
),
Is there a solution, to get matched records in substring of the label, not from scratch?
Example:
The records label is named 'coffee black'
When I type 'co' into the search field, the record will be shown.
'blac' won't match to any record.
Is this possible to find this record, when I type in a substring? Else I have to extend the autocompletion. TYPO3 Core, yuk! :-)
Thank you in advance!
After hours, I found the solution.
You have to write the tca like this:
'tx_db_colors' => array (
'exclude' => 0,
'label' => 'Farbe',
'config' => array (
"type" => "group",
"allowed" => "tx_db_colors",
"foreign_table" => "tx_db_colors",
"internal_type" => "db",
"size" => 1,
"minitems" => 0,
"maxitems" => 1,
'items' => array(array('', ''),),
'wizards' => array(
'suggest' => array(
'type' => 'suggest',
'default' => array(
'searchWholePhrase' => 1
),
),
),
)
),
Just add
'default' => array(
'searchWholePhrase' => 1
),
into the 'suggest' array.

Add a page browser to front-end extension

Is it possible to add a page browser (browse_links) like this to a front end extension?
Sure. Add the 'suggest' wizzard in the TCA for that field:
'yourlink' => array (
'label' => 'LLL:EXT:yourextension/locallang_general.xml:yourlink',
'config' => array (
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'size' => '1',
'maxitems' => '1',
'minitems' => '0',
'show_thumbs' => '1',
'wizards' => array(
'suggest' => array(
'type' => 'suggest',
),
),
),
),

Categories