pastebin

Paste Search Dynamic
Recent pastes
node comment
  1. <?php
  2. /**
  3.  * @file
  4.  * Plugin to provide access control based upon node comment status.
  5.  */
  6.  
  7. /**
  8.  * Plugins are described by creating a $plugin array which will be used
  9.  * by the system that includes this file.
  10.  */
  11. $plugin = array(
  12.   'title' => t("Node: comments are open"),
  13.   'description' => t('Control access by the nodes comment status.'),
  14.   'callback' => 'ctools_node_comment_ctools_access_check',
  15.   'summary' => 'ctools_node_comment_ctools_access_summary',
  16.   'required context' => new ctools_context_required(t('Node'), 'node'),
  17. );
  18.  
  19. /**
  20.  * Checks for access.
  21.  */
  22. function ctools_node_comment_ctools_access_check($conf, $context) {
  23.   return (!empty($context->data) && $context->data->comment == 2);
  24. }
  25.  
  26. /**
  27.  * Provides a summary description based upon the checked node_status.
  28.  */
  29. function ctools_node_comment_ctools_access_summary($conf, $context) {
  30.   return t('Returns true if the nodes comment status is "open".');
  31. }
  32. ?>
Parsed in 0.014 seconds