You are here

function crumbs_admin_weights_form in Crumbs, the Breadcrumbs suite 7.2

The form displayed on admin/structure/crumbs(/weights)

_state

Parameters

array $form:

string $type: E.g. 'tabledrag' or 'textual' or 'expansible'.

Return value

array

2 string references to 'crumbs_admin_weights_form'
crumbs_labs_menu in labs/crumbs_labs.module
Implements hook_menu().
crumbs_menu in ./crumbs.info.inc
Implements hook_menu().

File

admin/crumbs.admin.inc, line 13

Code

function crumbs_admin_weights_form($form, $form_state, $type = 'tabledrag') {
  $form = array();
  $info = crumbs()->pluginInfo;

  // Re-discover plugins, when the admin visits the weights configuration form.
  $info
    ->flushCaches();
  $form['crumbs_weights'] = array(
    '#title' => t('Weights'),
    // Fetching the default value is not automated by system_settings_form().
    '#default_value' => $info->userWeights,
    '#crumbs_plugin_info' => $info,
  );
  switch ($type) {
    case 'textual':

      // You need to enable crumbs_labs to get this.
      $form['crumbs_weights']['#type'] = 'crumbs_weights_textual';
      break;
    case 'expansible':

      // You need to enable crumbs_labs to get this.
      $form['crumbs_weights']['#type'] = 'crumbs_weights_expansible';
      break;
    case 'tabledrag':
    default:
      $form['crumbs_weights']['#type'] = 'crumbs_weights_tabledrag';
  }
  $form = system_settings_form($form);
  $form['#submit'][] = '_crumbs_admin_flush_cache';
  return $form;
}