You are here

function oa_notifications_node_form_notifications_render in Open Atrium Notifications 7.2

1 string reference to 'oa_notifications_node_form_notifications_render'
node_form_oa_notifications.inc in plugins/content_types/node_form_oa_notifications.inc
Notifications form for the node.

File

plugins/content_types/node_form_oa_notifications.inc, line 22
Notifications form for the node.

Code

function oa_notifications_node_form_notifications_render($subtype, $conf, $panel_args, &$context) {
  if (!variable_get('oa_messages_notifications', TRUE)) {

    // Set access to false on the original rather than removing so that
    // vertical tabs doesn't clone it. I think this is due to references.
    if (isset($context->form)) {
      $context->form['oa_notifications']['#access'] = FALSE;
    }
    return;
  }
  $node = $context->data;
  $block = new stdClass();
  $block->title = in_array($node->type, array(
    OA_SPACE_TYPE,
    OA_GROUP_TYPE,
    OA_SECTION_TYPE,
  )) ? t('Default Notifications') : t('Notifications');
  $block->module = t('oa_notifications');
  $block->delta = 'oa-notifications';
  drupal_add_js(drupal_get_path('module', 'oa_notifications') . '/oa_notifications.js');
  if (isset($context->form)) {
    if (isset($context->form['oa_notifications'])) {
      $form = $context->form['oa_notifications'];

      // Unset fieldset's theming.
      unset($form['#pre_render']);
      unset($form['#theme_wrappers']);
      $form['#type'] = '';
      $block->content['oa_notifications'] = $form;

      // Set access to false on the original rather than removing so that
      // vertical tabs doesn't clone it. I think this is due to references.
      $context->form['oa_notifications']['#access'] = FALSE;
    }
  }
  else {
    $block->content = t('Notifications');
  }
  return $block;
}