You are here

protected function GeshiFilterFilter::generalHighlightTagsSettings in GeSHi Filter for syntax highlighting 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Filter/GeshiFilterFilter.php \Drupal\geshifilter\Plugin\Filter\GeshiFilterFilter::generalHighlightTagsSettings()

Helper function for some settings form fields.

1 call to GeshiFilterFilter::generalHighlightTagsSettings()
GeshiFilterFilter::settingsForm in src/Plugin/Filter/GeshiFilterFilter.php
Create the settings form for the filter.

File

src/Plugin/Filter/GeshiFilterFilter.php, line 526

Class

GeshiFilterFilter
Provides a base filter for Geshi Filter.

Namespace

Drupal\geshifilter\Plugin\Filter

Code

protected function generalHighlightTagsSettings() {
  $form = [];

  // Generic tags.
  $form["tags"] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Generic syntax highlighting tags'),
    '#default_value' => $this
      ->tags(),
    '#description' => $this
      ->t('Tags that should activate the GeSHi syntax highlighting. Specify a space-separated list of tagnames.'),
  ];

  // Container tag styles.
  $form["tag_styles"] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Container tag style'),
    '#options' => [
      GeshiFilter::BRACKETS_ANGLE => '<code>' . htmlentities('<foo> ... </foo>') . '</code>',
      GeshiFilter::BRACKETS_SQUARE => '<code>' . htmlentities('[foo] ... [/foo]') . '</code>',
      GeshiFilter::BRACKETS_DOUBLESQUARE => '<code>' . htmlentities('[[foo]] ... [[/foo]]') . '</code>',
      GeshiFilter::BRACKETS_PHPBLOCK => $this
        ->t('PHP style source code blocks: <code>@php</code> and <code>@percent</code>', [
        '@php' => '<?php ... ?>',
        '@percent' => '<% ... %>',
      ]),
      GeshiFilter::BRACKETS_MARKDOWNBLOCK => '<code>' . htmlentities('```foo ... ```') . '</code>',
    ],
    '#default_value' => $this
      ->tagStyles(),
    '#description' => $this
      ->t('Select the container tag styles that should trigger GeSHi syntax highlighting.'),
  ];

  // Decode entities.
  $form["decode_entities"] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Decode entities'),
    '#default_value' => $this->settings['general_tags']['decode_entities'],
    '#description' => $this
      ->t('Decode entities, for example, if the code has been typed in a WYSIWYG editor.'),
  ];
  return $form;
}