protected function PatternSettingTypeBase::tokenForm in UI Patterns Settings 8.2
Returns the bind form field.
Parameters
array $form: The form definition array for the settings configuration form.
string $value: The stored default value.
\Drupal\ui_patterns_settings\Definition\PatternDefinitionSetting $def: The pattern definition.
Return value
array The form.
1 call to PatternSettingTypeBase::tokenForm()
- PatternSettingTypeBase::buildConfigurationForm in src/
Plugin/ PatternSettingTypeBase.php - Creates a generic configuration form for all settings types. Individual settings plugins can add elements to this form by overriding PatternSettingTypeBaseInterface::settingsForm(). Most plugins should not override this method unless they need to…
File
- src/
Plugin/ PatternSettingTypeBase.php, line 217
Class
- PatternSettingTypeBase
- Base class for UI Patterns Setting plugins.
Namespace
Drupal\ui_patterns_settings\PluginCode
protected function tokenForm(array $form, $value, PatternDefinitionSetting $def) {
$form[$def
->getName() . "_token"] = [
'#type' => 'textfield',
'#title' => $this
->t("Token for %label", [
'%label' => $def
->getLabel(),
]),
'#default_value' => $this
->getValue($value),
'#attributes' => [
'class' => [
'js-ui-patterns-settings-show-token-link',
'js-ui-patterns-settings__token',
],
],
'#wrapper_attributes' => [
'class' => [
'js-ui-patterns-settings__token-wrapper',
],
],
];
return $form;
}