You are here

function custom_pub_edit in Custom Publishing Options 7

Same name and namespace in other branches
  1. 6 custom_pub.module \custom_pub_edit()

Form callback function for the edit form.

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

File

./custom_pub.admin.inc, line 182
Admin functions.

Code

function custom_pub_edit($form, &$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' => $type['name'],
  );
  $form['node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Available on'),
    '#description' => t('The Node Types this option is available on.'),
    '#options' => node_type_get_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'),
  );
  if (!isset($type['default'])) {
    $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;
}