You are here

function _advanced_text_formatter_validate_allowed_html in Advanced Text Formatter 8

Same name and namespace in other branches
  1. 7 advanced_text_formatter.module \_advanced_text_formatter_validate_allowed_html()
  2. 2.1.x advanced_text_formatter.module \_advanced_text_formatter_validate_allowed_html()
  3. 2.0.x advanced_text_formatter.module \_advanced_text_formatter_validate_allowed_html()

Change tags from string to array to speed up the formatter view.

Parameters

array $element: Form element.

array $form_state: Form state.

1 string reference to '_advanced_text_formatter_validate_allowed_html'
AdvancedTextFormatter::settingsForm in src/Plugin/Field/FieldFormatter/AdvancedTextFormatter.php
Returns a form to configure settings for the formatter.

File

./advanced_text_formatter.module, line 324
Advanced Text Formatter

Code

function _advanced_text_formatter_validate_allowed_html($element, FormStateInterface $form_state) {
  $tags = array();
  $value = isset($element['#value']) ? trim($element['#value']) : '';
  if (!empty($value)) {
    $tags = preg_split('/\\s+|<|>/', $value, -1, PREG_SPLIT_NO_EMPTY);
  }
  $form_state
    ->setValue($element['#parents'], $tags);
}