Change default Panels panes settings (style, cache, etc)

Public

Site builder UX: Change default Panels panes settings (style, cache, etc) for new panes.

</> CopyGet raw version
php
  1. /**
  2.  * Implements hook_form_alter().
  3.  *
  4.  * Change default values for new Panels panes.
  5.  */
  6. function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  7. $panels_add_content_forms = array('ctools_block_content_type_edit_form', 'ctools_custom_content_type_edit_form', 'ctools_node_content_type_edit_form');
  8.  
  9. if (in_array($form_id, $panels_add_content_forms)) {
  10. // Set default 30 sec cache for all new panes.
  11. $form_state['pane']->cache = array(
  12. 'method' => 'simple',
  13. 'settings' => array('lifetime' => 30, 'granularity' => 'context'),
  14. );
  15.  
  16. // Set default style to "No markup at all" for all new panes.
  17. $form_state['pane']->style = array(
  18. 'style' => 'naked',
  19. 'settings' => NULL,
  20. );
  21. }
  22. }