function _advanced_text_formatter_widget_textarea_alter in Advanced Text Formatter 8
Same name and namespace in other branches
- 2.1.x advanced_text_formatter.module \_advanced_text_formatter_widget_textarea_alter()
- 2.0.x advanced_text_formatter.module \_advanced_text_formatter_widget_textarea_alter()
1 call to _advanced_text_formatter_widget_textarea_alter()
File
- ./
advanced_text_formatter.module, line 106 - Advanced Text Formatter
Code
function _advanced_text_formatter_widget_textarea_alter(&$element, FormStateInterface $form_state, $context) {
$widget = $context['widget'];
if (!\Drupal::moduleHandler()
->moduleExists('token') || !_advanced_text_formatter_show_token_tree($widget)) {
return;
}
$entity_type = $context['items']
->getEntity()
->getEntityTypeId();
$description = trim($element['#description']);
if (!empty($description)) {
if (substr($description, -1) != '.') {
$description .= '. ';
}
else {
$description .= ' ';
}
}
$description .= _advanced_text_formatter_browse_tokens($entity_type);
$element['#description'] = $description;
$element['value']['#description'] = $description;
}