You are here

function patterns_forms_get_formats_selector in Patterns 7.2

Same name and namespace in other branches
  1. 7 includes/forms/ \patterns_forms_get_formats_selector()

Builds a HTML select element with all the currently available patterns formats.


array $form (optional) If specified, the select form is appended: here. Default array().

mixed $default (optional) The default value for the selector.: Default PATTERNS_FORMAT_UNKNOWN.

bool $unknown (optional) If TRUE PATTERNS_FORMAT_UNKNOWN is added: to the 'available' formats. Default TRUE.

Return value

array $form The form containing the select element.

7 calls to patterns_forms_get_formats_selector()
patterns_edit in includes/forms/
Form constructor for editing a pattern. TODO:params
patterns_export_page1 in patterns_export/patterns_export.module
patterns_import_file in includes/forms/
Display the import pattern file form
patterns_import_source in includes/forms/
Form constructor for the Pattern import form.
patterns_import_url in includes/forms/
Display the import pattern url form

... See full list


includes/forms/, line 124


function patterns_forms_get_formats_selector(&$form = array(), $default = PATTERNS_FORMAT_UNKNOWN, $descr = NULL, $unknown = TRUE) {
  $descr = is_null($descr) ? t('Pattern will be validated and run against this format.') : t($descr);
  $formats = $unknown ? array(
  ) : array();
  $available_formats = patterns_parser_get_formats();
  if (!empty($available_formats)) {
    $formats = array_merge($formats, array_combine($available_formats, $available_formats));
  $form['format'] = array(
    '#type' => 'select',
    '#title' => t('Pattern syntax'),
    '#options' => $formats,
    '#default_value' => $default,
    '#description' => $descr,
  return $form;