You are here

function custom_pub_add in Custom Publishing Options 7

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

Form callback to add a publishing option.

_state

Parameters

$form:

Return value

mixed

1 string reference to 'custom_pub_add'
custom_pub_menu in ./custom_pub.module
Implements hook_menu().

File

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

Code

function custom_pub_add($form, &$form_state) {
  $form['state_fs'] = array(
    '#type' => 'fieldset',
    '#title' => t('Add a Publishing Option'),
  );
  $form['state_fs']['state'] = array(
    '#title' => t('Publishing label'),
    '#type' => 'textfield',
    '#description' => t('The label for your custom publishing option. This is the text that will be displayed on the node add/edit form.'),
    '#maxlength' => 255,
    '#required' => TRUE,
  );
  $form['state_fs']['state_machine'] = array(
    '#type' => 'textfield',
    '#title' => t('Option name'),
    '#description' => t('The machine-readable name of this publishing option. This text will be used for constructing the database table column name. This name must contain only lowercase letters, numbers, and underscores. This name must be unique.'),
    '#required' => TRUE,
  );
  $form['state_fs']['node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Available on'),
    '#description' => t('The Node Types this option is available on.'),
    '#options' => node_type_get_names(),
  );
  $form['state_fs']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add'),
  );
  return $form;
}