public function Title::buildFormElement in Linkit 8.4
The form element structure for this attribute to be used in the dialog.
Parameters
mixed $default_value: The default value for the element. Used when editing an attribute in the dialog.
Return value
array The form element.
Overrides AttributeInterface::buildFormElement
File
- src/
Plugin/ Linkit/ Attribute/ Title.php, line 28 - Contains \Drupal\linkit\Plugin\Linkit\Attribute\Title.
Class
- Title
- Title attribute.
Namespace
Drupal\linkit\Plugin\Linkit\AttributeCode
public function buildFormElement($default_value) {
$element = [
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $default_value,
'#maxlength' => 255,
'#size' => 40,
'#placeholder' => t('The "title" attribute value'),
];
if ($this->configuration['automatic_title']) {
$element['#attached']['library'][] = 'linkit/linkit.attribute.title';
$element['#placeholder'] = t('The "title" attribute value (auto populated)');
}
return $element;
}