public static function AdministrationForm::attach in Entity connect 8.2
Attach the common entityconnect settings to the given form.
Parameters
array $form: The form to attach to.
array $defaults: Entityconnect defaults.
2 calls to AdministrationForm::attach()
- AdministrationForm::buildForm in src/
Form/ AdministrationForm.php - Form constructor.
- EntityconnectFormUtils::fieldConfigEditFormAlter in src/
EntityconnectFormUtils.php - Adds entityconnect settings to the entity reference field config.
File
- src/
Form/ AdministrationForm.php, line 89
Class
- AdministrationForm
- Class DefaultForm.
Namespace
Drupal\entityconnect\FormCode
public static function attach(array &$form, array $defaults) {
$form['entityconnect'] = [
'#type' => 'details',
'#title' => t('EntityConnect default Parameters'),
'#open' => TRUE,
'#tree' => TRUE,
];
$form['entityconnect']['buttons'] = [
'#type' => 'fieldset',
'#title' => t('Buttons display Parameters'),
];
$form['entityconnect']['buttons']['button_add'] = [
'#required' => '1',
'#default_value' => $defaults['buttons']['button_add'],
'#description' => t('Default: "off"<br />
Choose "on" if you want the "add" buttons displayed by default.<br />
Each field can override this value.'),
'#weight' => '0',
'#type' => 'radios',
'#options' => [
'0' => t('on'),
'1' => t('off'),
],
'#title' => t('Default Entity Connect "add" button display'),
];
$form['entityconnect']['buttons']['button_edit'] = [
'#required' => '1',
'#default_value' => $defaults['buttons']['button_edit'],
'#description' => t('Default: "off"<br />
Choose "on" if you want the "edit" buttons displayed by default.<br />
Each field can override this value.'),
'#weight' => '1',
'#type' => 'radios',
'#options' => [
'0' => t('on'),
'1' => t('off'),
],
'#title' => t('Default Entity Connect "edit" button display'),
];
$form['entityconnect']['icons'] = [
'#type' => 'fieldset',
'#title' => t('Icons display Parameters'),
];
$form['entityconnect']['icons']['icon_add'] = [
'#required' => '1',
'#key_type_toggled' => '1',
'#default_value' => $defaults['icons']['icon_add'],
'#description' => t('Default: "Icon only"<br />
Choose "Icon + Text" if you want to see the edit (pencil) icon + the text displayed by default.<br />
Choose "Text only" if you don\'t want to see the edit (pencil) icon displayed by default.<br />
Each field can override this value.'),
'#weight' => '2',
'#type' => 'radios',
'#options' => [
'0' => t('Icon only'),
'1' => t('Icon + Text'),
'2' => t('Text only'),
],
'#title' => t('Default Entity Connect "add (+) icon" display'),
];
$form['entityconnect']['icons']['icon_edit'] = [
'#required' => '1',
'#default_value' => $defaults['icons']['icon_edit'],
'#description' => t('Default: "Icon only"<br />
Choose "Icon + Text" if you want to see the edit (pencil) icon + the text displayed by default.<br />
Choose "Text only" if you don\'t want to see the edit (pencil) icon displayed by default.<br />
Each field can override this value.'),
'#weight' => '3',
'#type' => 'radios',
'#options' => [
'0' => t('Icon only'),
'1' => t('Icon + Text'),
'2' => t('Text only'),
],
'#title' => t('Default Entity Connect "edit (pencil) icon" display'),
];
}