function boxes_box_form in Boxes 7
Same name and namespace in other branches
- 6 boxes.module \boxes_box_form()
Common element of the box form
2 calls to boxes_box_form()
- boxes_add_form in ./
boxes.admin.inc - Generate form for creating new boxes.
- boxes_block_configure in ./
boxes.module - Implements hook_block_configure().
2 string references to 'boxes_box_form'
- boxes_block_view in ./
boxes.module - Implements hook_block_view().
- boxes_footer in ./
boxes.module - Implements hook_footer().
File
- ./
boxes.module, line 400 - Core functionality for boxes module.
Code
function boxes_box_form($form, &$form_state) {
$box = $form_state['box'];
if (method_exists($box, "box_form")) {
return $box
->box_form($form, $form_state);
}
// For hook_block_save()
$form['plugin_key'] = array(
'#type' => 'value',
'#value' => $box->plugin_key,
);
$form['delta'] = array(
'#type' => 'value',
'#value' => $box->delta,
);
$form['description'] = array(
'#type' => 'textfield',
'#title' => t('Box description'),
'#default_value' => $box->description,
'#maxlength' => 64,
'#description' => t('A brief description of your box. Used for administrative purposes.'),
'#required' => TRUE,
'#weight' => -19,
);
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Box title'),
'#maxlength' => 64,
'#description' => t('The rendered title of the box as shown to the user.'),
'#default_value' => $box->title,
'#weight' => -18,
);
$form['options'] = $box
->options_form($form_state);
$form['options']['#weight'] = -17;
$form['boxes_adv'] = array(
'#type' => 'fieldset',
'#collapsed' => TRUE,
'#collapsible' => TRUE,
'#title' => t('Advanced Settings'),
);
$form['boxes_adv']['additional_classes'] = array(
'#title' => t('Additional CSS classes'),
'#description' => t('Optional CSS classes that will be added to the top-level div container for this box. Separate them with spaces.'),
'#type' => 'textfield',
'#default_value' => isset($box->options['additional_classes']) ? $box->options['additional_classes'] : '',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#attributes' => array(
'class' => array(
'boxes-ajax',
'use-ajax-submit',
),
),
);
$form['cancel'] = array(
'#type' => 'submit',
'#value' => t('Cancel'),
'#submit' => array(
'boxes_box_form_cancel_submit',
),
'#limit_validation_errors' => array(),
'#attributes' => array(
'class' => array(
'boxes-ajax',
'use-ajax-submit',
),
),
);
if (!empty($form_state['custom_action'])) {
$form['#action'] = url(drupal_is_front_page() ? '<front>' : $_GET['q'], array(
'query' => array(
'boxes_delta' => $box->delta,
'plugin_key' => $form_state['plugin_key'],
),
));
}
if (isset($form_state['init_form']) && $box
->use_multistep_create()) {
unset($form['options']);
unset($form['cancel']);
$form['submit']['#value'] = t('Continue');
if (!empty($form_state['custom_action'])) {
$form['#action'] = url(drupal_is_front_page() ? '<front>' : $_GET['q'], array(
'query' => array(
'boxes_delta' => $box->delta,
'init_form_continue' => TRUE,
'plugin_key' => $form_state['plugin_key'],
),
));
}
}
// Place wrapper DIV so we don't break in IE7/8 when jQuery UI tries to access the 'title' attribute on the form in a modal dialog
$form['#prefix'] = '<div id="boxes-box-form-wrapper">';
$form['#suffix'] = '</div>';
return $form;
}