You are here

function crumbs_admin_form in Crumbs, the Breadcrumbs suite 7

Same name and namespace in other branches
  1. 6.2 crumbs.admin.inc \crumbs_admin_form()
  2. 6 crumbs.admin.inc \crumbs_admin_form()
1 string reference to 'crumbs_admin_form'
crumbs_menu in ./crumbs.module
Implements hook_menu().

File

admin/crumbs.admin.inc, line 4

Code

function crumbs_admin_form() {
  $form = array();

  // drupal_add_js(drupal_get_path('module', 'crumbs') .'/crumbs.admin.js');
  // drupal_add_css(drupal_get_path('module', 'crumbs') .'/crumbs.admin.css');
  $text_sections = '';
  foreach (array(
    '(enabled)' => 'This section does not have a label, it is just anything at
the top. Criteria in here are considered explicitly enabled, and can be
prioritized by moving them up and down. Criteria that are further up, have a
higher priority. By default, only the asterisk * wildcard is in this section.',
    'disabled' => 'Criteria in this section are considered explicitly
disabled. By default, this section is empty.<br/>(*)',
    'disabled by default' => 'Criteria in this section are implicitly
disabled. New critera end up here, if the plugin code says so.<br/>(**)',
    'inherit' => 'Criteria in this section "inherit" their weight and
enabled/disabled status from the best matching wildcard criterion. See the
documentation for details. New criteria end up in this section by default.<br/>(**)',
  ) as $title => $desc) {
    $desc = t($desc);
    $text_sections .= <<<EOT
<dt><pre>---- {<span class="php-variable">$title</span>} ----</pre></dt>
<dd>{<span class="php-variable">$desc</span>}</dd>
EOT;
  }
  $text_placeholders['!text_sections'] = '<dl>' . $text_sections . '</dl>';
  $text_footnotes = '';
  foreach (array(
    '*' => 'The order of criteria in this section has no meaning, and is not saved.
Instead, whenever the form is displayed, these criteria are sorted by name.',
    '**' => 'Whatever you put in these sections, is not saved. Instead, whenever
the form is displayed, the section will be filled with any criteria that are
not already in "enabled" or "disabled", sorted by name.',
  ) as $title => $desc) {
    $desc = t($desc);
    $text_footnotes .= <<<EOT
<p>({<span class="php-variable">$title</span>}) {<span class="php-variable">$desc</span>}</p>
EOT;
  }
  $text_placeholders['!text_footnotes'] = '<dl>' . $text_footnotes . '</dl>';
  $text = <<<EOT
<p>To build a breadcrumb trail, Crumbs takes the system path of the current
page, and determines a "parent path". This process is repeated with the parent,
until it arrives at the front page path, or until a loop is detected.</p>
<p>There are plenty of criteria available, that Crumbs can use to find a parent
path. This settings form allows to enable, disable and prioritize these
criteria, by moving (cut+paste) lines of text up and down.</p>
<p>The textarea has these sections:</p>
!text_sections
!text_footnotes
<p>Labels on the criteria have no meaning when you save the form, and are reset
whenever the form is displayed.</p>
EOT;
  $form['instructions'] = array(
    '#markup' => t($text, $text_placeholders),
  );
  $form['settings'] = array(
    '#type' => 'textarea',
    '#title' => t('Order of criteria for parent-finding.'),
    '#rows' => 24,
    // TODO: Add a CSS file? Or totally revamp this settings form?
    '#attributes' => array(
      'style' => 'font-family:"Courier new", monospace;',
    ),
  );
  $form['show_current_page'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show the current page at the end of the breadcrumb trail.'),
    '#default_value' => variable_get('crumbs_show_current_page', FALSE),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Save',
  );
  $form['settings']['#default_value'] = _crumbs_get_default_text();
  return $form;
}