You are here

function node_deploy_add_form in Deploy - Content Staging 6

Display node "add to plan" form.

Parameters

$form_state: FAPI form state

$node: The node we're attempting to deploy.

Return value

FAPI array

See also

node_deploy_add_form_submit()

1 string reference to 'node_deploy_add_form'
node_deploy_menu in modules/node_deploy/node_deploy.module
Implementation of hook_menu().

File

modules/node_deploy/node_deploy.pages.inc, line 19
Page handlers for node deployment pages.

Code

function node_deploy_add_form($form_state, $node) {
  $options = deploy_get_plan_options();
  if (!empty($options)) {
    $form['pid'] = array(
      '#title' => t('Deployment Plan'),
      '#type' => 'select',
      '#options' => $options,
      '#required' => TRUE,
      '#description' => t('The deployment plan to add this !type to.', array(
        '!type' => $node->type,
      )),
    );
    $form['nid'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->nid,
    );

    // This is kind of a hack, but it allows us to get the title into the
    // deployment plan without a node_load() or query on the other side.
    $form['title'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->title,
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
    );
    return $form;
  }
  return array(
    'empty' => array(
      '#value' => t('You currently do not have any plans set up.'),
    ),
  );
}