function boxes_admin_ui_type_form in Boxes 7.2
Generates the bean type editing form.
1 string reference to 'boxes_admin_ui_type_form'
- boxes_admin_ui_menu in boxes_admin_ui/
boxes_admin_ui.module - Implements hook_menu().
File
- boxes_admin_ui/
boxes_admin_ui.admin.inc, line 68 - Boxes Admin Page
Code
function boxes_admin_ui_type_form($form, &$form_state, $box_type = NULL) {
$form['new'] = array(
'#type' => 'value',
'#value' => TRUE,
);
// If bean_type is null then load an empty one.
if (is_null($box_type)) {
$plugin_info = _boxes_admin_default_plugin();
$plugin_info['name'] = '';
$box_type = new BoxCustom($plugin_info);
}
elseif (!method_exists($box_type, 'getExportStatus') || $box_type
->getExportStatus() == 'Normal') {
$form['new'] = array(
'#type' => 'value',
'#value' => FALSE,
);
}
$disabled = !$box_type
->isEditable();
if ($disabled) {
drupal_set_message(t('This Block Type can not be edited'));
}
$form['box_type'] = array(
'#type' => 'value',
'#value' => $box_type,
);
$form['label'] = array(
'#title' => t('Label'),
'#type' => 'textfield',
'#default_value' => $box_type
->getLabel(),
'#description' => t('The human-readable name of this block type.'),
'#required' => TRUE,
'#size' => 30,
'#disabled' => $disabled,
);
$form['description'] = array(
'#title' => t('Description'),
'#type' => 'textarea',
'#default_value' => $box_type
->getDescription(),
'#description' => t('The description of this block type.'),
'#disabled' => $disabled,
);
// Machine-readable type name.
$form['name'] = array(
'#type' => 'machine_name',
'#default_value' => isset($box_type->type) ? $box_type->type : '',
'#maxlength' => 32,
'#machine_name' => array(
'exists' => 'boxes_type_load',
'source' => array(
'label',
),
),
'#description' => t('A unique machine-readable name for this block type. It must only contain lowercase letters, numbers, and underscores.'),
'#disabled' => $disabled,
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save Block type'),
'#weight' => 40,
'#disabled' => $disabled,
);
// This is a new bean type.
if (isset($plugin_info)) {
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete Block type'),
'#weight' => 45,
'#limit_validation_errors' => array(),
'#submit' => array(
'boxes_type_form_submit',
),
'#disabled' => $disabled,
);
}
return $form;
}