function _shortcut_link_form_elements
_shortcut_link_form_elements($shortcut_link = NULL)
Helper function for building a form for adding or editing shortcut links.
Parameters
$shortcut_link: (optional) An array representing the shortcut link that will be edited. If not provided, a new link will be created.
Return value
An array of form elements.
File
- modules/shortcut/shortcut.admin.inc, line 466
- Administrative page callbacks for the shortcut module.
Code
function _shortcut_link_form_elements($shortcut_link = NULL) { if (!isset($shortcut_link)) { $shortcut_link = array( 'link_title' => '', 'link_path' => '' ); } else { $shortcut_link['link_path'] = ($shortcut_link['link_path'] == '<front>') ? '' : drupal_get_path_alias($shortcut_link['link_path']); } $form['shortcut_link']['#tree'] = TRUE; $form['shortcut_link']['link_title'] = array( '#type' => 'textfield', '#title' => t('Name'), '#description' => t('The name of the shortcut.'), '#size' => 40, '#maxlength' => 255, '#default_value' => $shortcut_link['link_title'], '#required' => TRUE, ); $form['shortcut_link']['link_path'] = array( '#type' => 'textfield', '#title' => t('Path'), '#description' => t('The path to the shortcut.'), '#size' => 40, '#maxlength' => 255, '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), '#default_value' => $shortcut_link['link_path'], ); $form['#validate'][] = 'shortcut_link_edit_validate'; $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), ); return $form; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!shortcut!shortcut.admin.inc/function/_shortcut_link_form_elements/7.x