You are here

function custom_pub_edit in Custom Publishing Options 6

Same name and namespace in other branches
  1. 7 custom_pub.admin.inc \custom_pub_edit()

Form callback function for edit form.

1 string reference to 'custom_pub_edit'
custom_pub_forms in ./custom_pub.module
Implements hook_forms().

File

./custom_pub.module, line 205
Adds the ability to add Custom publishing options to the node Add/Edit form.

Code

function custom_pub_edit(&$form_state, $type) {
  $form['type'] = array(
    '#type' => 'value',
    '#value' => $type,
  );
  $form['state'] = array(
    '#title' => t('Publishing label'),
    '#type' => 'textfield',
    '#maxlength' => 255,
    '#size' => 100,
    '#default_value' => check_plain($type['name']),
  );
  $form['node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Available on'),
    '#description' => t('The Node Types this option is available on.'),
    '#options' => node_get_types('names'),
    '#default_value' => isset($type['node_types']) ? array_keys($type['node_types']) : array(),
  );
  $form['stateh'] = array(
    '#type' => 'hidden',
    '#value' => $type['type'],
  );
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $form['delete'] = array(
    '#type' => 'submit',
    '#value' => t('Delete'),
    '#attributes' => array(
      'id' => 'edit-delete',
    ),
  );
  $form['#theme'][] = 'custom_pub_edit_form';
  $form['#validate'][] = 'custom_pub_edit_validate';
  $form['#submit'][] = 'custom_pub_edit_submit';
  return $form;
}