You are here

class AdvancedTextFormatterTokenTree in Advanced Text Formatter 2.0.x

Same name and namespace in other branches
  1. 2.1.x src/AdvancedTextFormatterTokenTree.php \Drupal\advanced_text_formatter\AdvancedTextFormatterTokenTree

Hierarchy

Expanded class hierarchy of AdvancedTextFormatterTokenTree

1 file declares its use of AdvancedTextFormatterTokenTree
advanced_text_formatter.module in ./advanced_text_formatter.module
Advanced Text Formatter

File

src/AdvancedTextFormatterTokenTree.php, line 7

Namespace

Drupal\advanced_text_formatter
View source
class AdvancedTextFormatterTokenTree implements TrustedCallbackInterface {

  /**
   * {@inheritdoc}
   */
  public static function trustedCallbacks() {
    return [
      'preRender',
    ];
  }

  /**
   * Add available tokens link to text_format element.
   *
   * @param array $element
   *   Form element
   *
   * @return array
   *   Form element
   */
  public static function preRender($element) {
    $element['format']['show_token'] = array(
      '#type' => 'container',
      'link' => array(
        '#markup' => _advanced_text_formatter_browse_tokens($element['#entity_type']),
      ),
      '#attributes' => array(
        'class' => array(
          'clearfix',
        ),
      ),
      '#weight' => 99,
    );
    return $element;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AdvancedTextFormatterTokenTree::preRender public static function Add available tokens link to text_format element.
AdvancedTextFormatterTokenTree::trustedCallbacks public static function Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface::trustedCallbacks
TrustedCallbackInterface::THROW_EXCEPTION constant Untrusted callbacks throw exceptions.
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION constant Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
TrustedCallbackInterface::TRIGGER_WARNING constant Untrusted callbacks trigger E_USER_WARNING errors.