node_comment.inc 923 B

12345678910111213141516171819202122232425262728293031
  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. }