You are here

function custom_pub_add in Custom Publishing Options 6

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

Form callback function for add form.

1 string reference to 'custom_pub_add'
custom_pub_admin in ./custom_pub.module
Callback function for our menu item.

File

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

Code

function custom_pub_add(&$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_get_types('names'),
  );
  $form['state_fs']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add'),
  );
  return $form;
}