You are here

og_is_node_group.inc in Organic groups 7.2

Same filename and directory in other branches
  1. 7 plugins/access/og_is_node_group.inc

File

plugins/access/og_is_node_group.inc
View source
<?php

/**
 * @file
 * Plugin to provide access control based on existence of a specified context.
 */
$plugin = array(
  'title' => t("OG: Node is an OG group"),
  'description' => t('Control access by whether or not a node is of type "Group".'),
  'callback' => 'og_is_node_group_check',
  'summary' => 'og_is_node_group_summary',
  'required context' => new ctools_context_required(t('Node'), 'node'),
);

/**
 * Check for access.
 */
function og_is_node_group_check($conf, $context) {

  // As far as I know there should always be a context at this point, but this
  // is safe.
  if (empty($context) || empty($context->data) || empty($context->data->nid)) {
    return FALSE;
  }
  return og_is_group('node', $context->data);
}

/**
 * Provide a summary description based upon the specified context
 */
function og_is_node_group_summary($conf, $context) {
  return t('@identifier is an OG group', array(
    '@identifier' => $context->identifier,
  ));
}

Functions

Namesort descending Description
og_is_node_group_check Check for access.
og_is_node_group_summary Provide a summary description based upon the specified context