node_status.inc 915 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @file
  4. * Plugin to provide access control based upon node (un)published 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: (un)published"),
  12. 'description' => t('Control access by the nodes published status.'),
  13. 'callback' => 'ctools_node_status_ctools_access_check',
  14. 'summary' => 'ctools_node_status_ctools_access_summary',
  15. 'required context' => new ctools_context_required(t('Node'), 'node'),
  16. );
  17. /**
  18. * Check for access.
  19. */
  20. function ctools_node_status_ctools_access_check($conf, $context) {
  21. return (!empty($context->data) && $context->data->status);
  22. }
  23. /**
  24. * Provide a summary description based upon the checked node_statuss.
  25. */
  26. function ctools_node_status_ctools_access_summary($conf, $context) {
  27. return t('Returns true if the nodes status is "published".');
  28. }