function shortcut_set_customize

Form callback: builds the form for customizing shortcut sets.

Parameters

$form: An associative array containing the structure of the form.

$form_state: An associative array containing the current state of the form.

$shortcut_set: An object representing the shortcut set which is being edited.

Return value

An array representing the form definition.

See also

shortcut_set_customize_submit()

Related topics

1 string reference to 'shortcut_set_customize'
shortcut_menu in drupal/core/modules/shortcut/shortcut.module
Implements hook_menu().

File

drupal/core/modules/shortcut/shortcut.admin.inc, line 267
Administrative page callbacks for the shortcut module.

Code

function shortcut_set_customize($form, &$form_state, $shortcut_set) {
  $form['#shortcut_set_name'] = $shortcut_set->set_name;
  $form['shortcuts'] = array(
    '#tree' => TRUE,
    '#weight' => -20,
    'links' => array(),
  );
  foreach ($shortcut_set->links as $link) {
    $mlid = $link['mlid'];
    $form['shortcuts']['links'][$mlid]['name']['#markup'] = l($link['link_title'], $link['link_path']);
    $form['shortcuts']['links'][$mlid]['weight'] = array(
      '#type' => 'weight',
      '#title' => t('Weight'),
      '#delta' => 50,
      '#default_value' => $link['weight'],
      '#attributes' => array(
        'class' => array(
          'shortcut-weight',
        ),
      ),
    );
    $links['edit'] = array(
      'title' => t('edit'),
      'href' => "admin/config/user-interface/shortcut/link/{$mlid}",
    );
    $links['delete'] = array(
      'title' => t('delete'),
      'href' => "admin/config/user-interface/shortcut/link/{$mlid}/delete",
    );
    $form['shortcuts']['links'][$mlid]['operations'] = array(
      '#type' => 'operations',
      '#links' => $links,
    );
  }
  $form['actions'] = array(
    '#type' => 'actions',
    '#access' => !empty($shortcut_set->links),
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save changes'),
  );
  return $form;
}