You are here

function _geshifilter_general_highlight_tags_settings in GeSHi Filter for syntax highlighting 7

Same name and namespace in other branches
  1. 5.2 geshifilter.admin.inc \_geshifilter_general_highlight_tags_settings()
  2. 6 geshifilter.admin.inc \_geshifilter_general_highlight_tags_settings()

Helper function for some settings form fields usable as general and specific settings.

Parameters

stdClass $format format object (e.g. with field $format->format).:

2 calls to _geshifilter_general_highlight_tags_settings()
geshifilter_admin_general_settings in ./geshifilter.admin.inc
General settings form for the GeSHi filter.
_geshifilter_filter_settings in ./geshifilter.admin.inc
Form (items) for filter settings.

File

./geshifilter.admin.inc, line 412

Code

function _geshifilter_general_highlight_tags_settings($format = NULL) {
  $form = array();
  $f = $format === NULL ? '' : "_{$format->format}";
  $format_id = $format === NULL ? NULL : $format->format;

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

  // Decode entities.
  $form["geshifilter_decode_entities{$f}"] = array(
    '#type' => 'checkbox',
    '#title' => t('Decode entities'),
    '#default_value' => geshifilter_decode_entities($format_id),
    '#description' => t('Decode entities, for example, if the code has been typed in a WYSIWYG editor.'),
  );

  // Container tag styles.
  $form["geshifilter_tag_styles{$f}"] = array(
    '#type' => 'checkboxes',
    '#title' => t('Container tag style'),
    '#options' => array(
      GESHIFILTER_BRACKETS_ANGLE => '<code>' . check_plain('<foo> ... </foo>') . '</code>',
      GESHIFILTER_BRACKETS_SQUARE => '<code>' . check_plain('[foo] ... [/foo]') . '</code>',
      GESHIFILTER_BRACKETS_DOUBLESQUARE => '<code>' . check_plain('[[foo]] ... [[/foo]]') . '</code>',
      GESHIFILTER_BRACKETS_PHPBLOCK => t('PHP style source code blocks: !php and !percent', array(
        '!php' => '<code>' . check_plain('<?php ... ?>') . '</code>',
        '!percent' => '<code>' . check_plain('<% ... %>') . '</code>',
      )),
    ),
    '#default_value' => _geshifilter_tag_styles($format_id),
    '#description' => t('Select the container tag styles that should trigger GeSHi syntax highlighting.'),
  );
  return $form;
}