function party_settings_pieces_order_form in Party 7
Same name and namespace in other branches
- 8.2 party.admin.inc \party_settings_pieces_order_form()
Settings form for ordering the party pieces.
1 string reference to 'party_settings_pieces_order_form'
- party_menu in ./
party.module - Implements hook_menu().
File
- ./
party.admin.inc, line 53 - Admin page callback file for the party module.
Code
function party_settings_pieces_order_form($form, &$form_state) {
// Get the pieces. These come in with the stored weight setting already.
$pieces = party_get_party_piece_info();
$form['#tree'] = TRUE;
foreach ($pieces as $path => $piece) {
$form['pieces'][$path]['name'] = array(
'#markup' => check_plain($piece['title']),
);
$form['pieces'][$path]['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight for @title', array(
'@title' => $piece['title'],
)),
'#title_display' => 'invisible',
'#delta' => 10,
'#default_value' => isset($piece['weight']) ? $piece['weight'] : 0,
);
}
// Include a submit button and weight if more than one piece exists.
if (count($pieces) > 1) {
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
}
elseif (isset($piece)) {
unset($form['pieces'][$path]['weight']);
}
return $form;
}