panels_ipe.api.php 843 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @file
  4. * Hooks provided by Panels In-Place Editor.
  5. */
  6. /**
  7. * Allow modules to control access to the Panels IPE.
  8. *
  9. * @param panels_display $display
  10. * The panels display about to be rendered.
  11. *
  12. * @return TRUE|FALSE|NULL
  13. * Returns TRUE to allow access, FALSE to deny, or NULL if the module
  14. * implementing this hook doesn't care about access for the given display.
  15. */
  16. function hook_panels_ipe_access(panels_display $display) {
  17. // We only care about displays with the 'panelizer' context.
  18. if (!isset($display->context['panelizer'])) {
  19. return NULL;
  20. }
  21. if ($display->context['panelizer']->type[0] == 'entity:node') {
  22. // Allow or deny IPE access based on node type.
  23. return $display->context['panelizer']->data->type == 'awesome_page';
  24. }
  25. // Otherwise, deny access to everything!
  26. return FALSE;
  27. }