Projet

Général

Profil

Paste
Télécharger (924 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / plugins / access / node_comment.inc @ 6e3ce7c2

1
<?php
2

    
3
/**
4
 * @file
5
 * Plugin to provide access control based upon node comment status.
6
 */
7

    
8
/**
9
 * Plugins are described by creating a $plugin array which will be used
10
 * by the system that includes this file.
11
 */
12
$plugin = array(
13
  'title' => t("Node: comments are open"),
14
  'description' => t('Control access by the nodes comment status.'),
15
  'callback' => 'ctools_node_comment_ctools_access_check',
16
  'summary' => 'ctools_node_comment_ctools_access_summary',
17
  'required context' => new ctools_context_required(t('Node'), 'node'),
18
);
19

    
20
/**
21
 * Checks for access.
22
 */
23
function ctools_node_comment_ctools_access_check($conf, $context) {
24
  return (!empty($context->data) && $context->data->comment == 2);
25
}
26

    
27
/**
28
 * Provides a summary description based upon the checked node_status.
29
 */
30
function ctools_node_comment_ctools_access_summary($conf, $context) {
31
  return t('Returns true if the nodes comment status is "open".');
32
}