You are here

function path_breadcrumbs_edit_form in Path Breadcrumbs 7

Form for creating and editing path breadcrumbs.

1 string reference to 'path_breadcrumbs_edit_form'
path_breadcrumbs_menu in ./path_breadcrumbs.module
Implements hook_menu().

File

./path_breadcrumbs.module, line 122

Code

function path_breadcrumbs_edit_form($form, $form_state, $path_breadcrumb = NULL) {
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Display name'),
    '#required' => TRUE,
  );
  $form['path'] = array(
    '#type' => 'textfield',
    '#title' => t('Path'),
    '#description' => t('No first slash. Example: node/10/edit. Also you may use wildcards with * symbol. Example: node/*/edit.'),
    '#required' => TRUE,
  );
  $form['home'] = array(
    '#type' => 'checkbox',
    '#title' => t('Prepend Home Link to the Breadcrumb'),
    '#description' => t('First breadcrumb will be a link to the front page.'),
  );
  $form['titles'] = array(
    '#type' => 'textarea',
    '#title' => t('Breadcrumb titles'),
    '#required' => TRUE,
    '#description' => t('Enter one title per line.'),
  );
  $form['paths'] = array(
    '#type' => 'textarea',
    '#title' => t('Breadcrumb paths'),
    '#required' => TRUE,
    '#description' => t('Enter one path per line. You can use @front to link
      to the front page, or @none for no link.', array(
      '@front' => '<front>',
      '@none' => '<none>',
    )),
  );

  // Add default values to form if $path object exists.
  if (!empty($path_breadcrumb)) {
    foreach ($path_breadcrumb as $key => $value) {
      $form[$key]['#default_value'] = $value;
    }

    // Place path_breadcrumbs object in form.
    $form['path_breadcrumbs'] = array(
      '#type' => 'value',
      '#value' => $path_breadcrumb,
    );
  }
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}