Projet

Général

Profil

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

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

1
<?php
2

    
3
/**
4
 * @file
5
 * Plugin to provide access control based upon node (un)published 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: (un)published"),
14
  'description' => t('Control access by the nodes published status.'),
15
  'callback' => 'ctools_node_status_ctools_access_check',
16
  'summary' => 'ctools_node_status_ctools_access_summary',
17
  'required context' => new ctools_context_required(t('Node'), 'node'),
18
);
19

    
20
/**
21
 * Check for access.
22
 */
23
function ctools_node_status_ctools_access_check($conf, $context) {
24
  return (!empty($context->data->status) && $context->data->status);
25
}
26

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