1 |
e4c061ad
|
Assos Assos
|
<?php
|
2 |
c304a780
|
Assos Assos
|
|
3 |
e4c061ad
|
Assos Assos
|
/**
|
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 |
|
|
} |