Form callback: builds the form for customizing shortcut sets.
$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.
An array representing the form definition.
shortcut_set_customize_submit()
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;
}