node_comment.inc 924 B

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