workbench_moderation_node_draft.inc in Contextual Administration 7
File
contrib/context_admin_wbm/plugins/context_admin/workbench_moderation_node_draft.inc
View source
<?php
$plugin = array(
'title' => t('Workbench Moderation Node Draft'),
'description' => t('Places a workbench_moderation node draft on a custom page.'),
'required context' => new ctools_context_required(t('Node'), 'node'),
'content form' => 'context_admin_wbm_workbench_moderation_node_draft_content_form',
'content form submit' => 'context_admin_wbm_workbench_moderation_node_draft_content_form_submit',
'render' => 'context_admin_wbm_workbench_moderation_node_draft_render_page',
);
function context_admin_wbm_workbench_moderation_node_draft_content_form($form, $form_state) {
$conf = $form_state['conf'];
$form['panelizer_edit'] = array(
'#type' => 'checkbox',
'#title' => t('Allow Panelizer Edits'),
'#description' => t('Allow panelizer edits to be performed on the view of this revision page.'),
'#default_value' => !empty($conf['panelizer_edit']) ? $conf['panelizer_edit'] : FALSE,
);
return $form;
}
function context_admin_wbm_workbench_moderation_node_draft_content_form_submit($form, &$form_state) {
if (isset($form_state['values']['panelizer_edit'])) {
$form_state['conf']['panelizer_edit'] = $form_state['values']['panelizer_edit'];
}
}
function context_admin_wbm_workbench_moderation_node_draft_render_page($handler, $contexts, $args, $test = TRUE) {
$node = $contexts[$handler->conf['submitted_context']]->data;
module_load_include('inc', 'workbench_moderation', 'workbench_moderation.node');
$page = page_manager_get_current_page();
context_admin_get_current_page($page);
return workbench_moderation_node_view_draft($node);
}