You are here

function custom_breadcrumbs_paths_form in Custom Breadcrumbs 7.2

Same name and namespace in other branches
  1. 6.2 custom_breadcrumbs_paths/custom_breadcrumbs_paths.module \custom_breadcrumbs_paths_form()

Form builder; Provide an edit form for a custom breadcrumb paths breadcrumb.

See also

custom_breadcrumbs_form_validate()

custom_breadcrumbs_form_submit()

1 string reference to 'custom_breadcrumbs_paths_form'
custom_breadcrumbs_paths_menu in custom_breadcrumbs_paths/custom_breadcrumbs_paths.module
Implements hook_menu().

File

custom_breadcrumbs_paths/custom_breadcrumbs_paths.module, line 285

Code

function custom_breadcrumbs_paths_form($form, &$form_state, $type) {
  $bid = arg(5);
  $breadcrumb = NULL;
  if (isset($bid)) {
    drupal_set_title(t('Edit Custom Breadcrumb for Path'));
    $path_breadcrumbs = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbs_paths', NULL, array(
      'bid' => $bid,
    ));
    $breadcrumb = array_pop($path_breadcrumbs);
  }
  else {
    drupal_set_title(t('Add Custom Breadcrumb for Path'));
  }
  $description = t('The Drupal path that this custom breadcrumb trail will apply to.');
  if (variable_get('custom_breadcrumbs_paths_allow_wildcards', FALSE)) {
    $description .= ' ' . t("The '*' character can be used as a wildcard to set a custom breadcrumb for all matching paths. For example, foo/bar* could be used to match every page with a path beginning with foo/bar. Do not include language prefixes in the path. This will be handled automatically according to the selected language.");
  }
  $form['specific_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Specific Path'),
    '#required' => TRUE,
    '#description' => $description,
    '#default_value' => isset($breadcrumb->specific_path) ? $breadcrumb->specific_path : NULL,
    '#weight' => -10,
  );
  $form += custom_breadcrumbs_common_form_elements($bid, $breadcrumb);

  // Store the function to call to save this breadcrumb.
  $form['#module'] = 'custom_breadcrumbs_paths';
  $form['#infokey'] = 'paths';
  $form['#submit'][] = 'custom_breadcrumbs_form_submit';
  $form['#validate'][] = 'custom_breadcrumbs_form_validate';
  return $form;
}