oa_notifications_pane.inc in Open Atrium Notifications 7.2
File
plugins/content_types/oa_notifications_pane.inc
View source
<?php
$plugin = array(
'title' => t('Notifications'),
'description' => t('Displays the list of Groups, Teams and Users that will be notified of a change to an Entity.'),
'single' => TRUE,
'category' => array(
t('OA Admin'),
-9,
),
'render callback' => 'oa_notifications_pane_render',
'required context' => new ctools_context_required(t('Node'), 'node'),
);
function oa_notifications_pane_render($subtype, $conf, $args, $context) {
global $user;
if (!isset($context->data) || !variable_get('oa_messages_notifications', TRUE)) {
return FALSE;
}
$node = $context->data;
if (empty($user->uid) || !node_access('view', $node)) {
return FALSE;
}
$form = drupal_get_form('oa_notifications_edit_form', $node);
if (!isset($form[OA_NOTIFY_FORM]['source_id']) && !isset($form[OA_NOTIFY_FORM]['notify_list'])) {
return FALSE;
}
$block = new stdClass();
$block->title = t('Notifications');
$block->content = $form;
return $block;
}
function oa_notifications_edit_form($form, &$form_state, $node) {
ctools_form_include_file($form_state, drupal_get_path('module', 'oa_notifications') . '/plugins/content_types/oa_notifications_pane.inc');
$form['#node'] = $node;
$form[OA_NOTIFY_FORM] = array(
'#type' => 'container',
'#tree' => TRUE,
);
oa_notifications_form_fields($form[OA_NOTIFY_FORM], $form_state, $node);
return $form;
}