Guest User

Untitled

a guest
Jul 20th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. /**
  2. * Implementation of hook_form().
  3. */
  4. function panels_node_form(&$node, &$param) {
  5. $form['panels_node']['#tree'] = TRUE;
  6. if (empty($node->nid)) {
  7. // Grab our selected layout from the $node, If it doesn't exist, try arg(3)
  8. // and if that doesn't work present them with a list to pick from.
  9. $panel_layout = isset($node->panel_layout) ? $node->panel_layout : arg(3);
  10. if (!isset($node->panel_layout) && arg(3)) {
  11. $node->panel_layout = arg(3);
  12. }
  13. if (empty($panel_layout)) {
  14. $opts = $_GET;
  15. unset($opts['q']);
  16. return drupal_goto('node/add/panel/choose-layout', $opts);
  17. }
  18.  
  19.  
  20. panels_load_include('plugins');
  21. $layout = panels_get_layout($panel_layout);
  22. if (empty($layout)) {
  23. return drupal_not_found();
  24. }
  25. $form['panels_node']['layout'] = array(
  26. '#type' => 'value',
  27. '#value' => $panel_layout,
  28. );
  29. }
Add Comment
Please, Sign In to add comment