You are here

function _publishcontent_configure_publish_button in Publish Content 7

Add the publish button to the node edit form.

1 call to _publishcontent_configure_publish_button()
publishcontent_form_node_form_alter in ./publishcontent.module
Implements hook_form_FORM_ID_alter().

File

./publishcontent.module, line 417
Add link to publish or unpublish a node, with access control based on the node type

Code

function _publishcontent_configure_publish_button(&$form, &$form_state) {
  $node = $form['#node'];
  if (empty($node->nid) || empty($form['actions'])) {

    // Don't include the publish button on node add forms.
    return;
  }

  // Add either the publish or unpublish buttons.
  $form['actions']['publish'] = empty($node->status) ? publishcontent_render_publish_button() : publishcontent_render_unpublish_button();
}