diff --git a/baseline_content.info b/baseline_content.info
index 36d470d..e0a2506 100644
--- a/baseline_content.info
+++ b/baseline_content.info
@@ -9,3 +9,7 @@ files[] = migrations/baseline_content.field_collection.inc
files[] = migrations/baseline_content.node.inc
files[] = migrations/baseline_content.menu_links.inc
files[] = migrations/baseline_content.terms.inc
+files[] = migrations/baseline_content.panelizer.default.inc
+files[] = migrations/baseline_content.panelizer.entity.inc
+files[] = plugins/panelizer.default.inc
+files[] = plugins/panelizer.entity.inc
diff --git a/baseline_content.module b/baseline_content.module
index ee025ee..413ddfe 100644
--- a/baseline_content.module
+++ b/baseline_content.module
@@ -14,6 +14,52 @@
* - Terms
*/
+include('files/baseline_content.panelizer.inc');
+
+function baseline_content_permission() {
+ return array(
+ 'export panelizer settings' => array(
+ 'title' => t('Export Panelizer settings'),
+ 'description' => t('Allows the user to generate an export of the specified Default and Entity panelizer settings, for re-import via XML. This permission should only be granted to developers.'),
+ ),
+ );
+}
+
+/**
+ * Implements hook_menu().
+ */
+function baseline_content_menu() {
+ $items = array();
+ $items['admin/config/content/baseline_content'] = array(
+ 'title' => 'Baseline content',
+ 'description' => 'Baseline content functionality.',
+ 'position' => 'left',
+ 'page callback' => 'system_admin_menu_block_page',
+ 'file' => 'system.admin.inc',
+ 'file path' => drupal_get_path('module', 'system'),
+ 'access arguments' => array('access administration pages'),
+ );
+ $items['admin/config/content/baseline_content/panelizer'] = array(
+ 'title' => 'Export panelizer settings',
+ 'description' => 'Generates an XML file that can be used for re-import.',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('baseline_content_panelizer_input_form'),
+ 'access arguments' => array('export panelizer settings'),
+ );
+ $items['admin/config/content/baseline_content/panelizer/export'] = array(
+ 'type' => MENU_CALLBACK,
+ 'title'=>'Panelizer export',
+ 'access arguments' => array('export panelizer settings'),
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('baseline_content_panelizer_export_form'),
+ );
+ return $items;
+}
+
+function baseline_content_xml_add_single(&$default_output, $tag, $value) {
+ $default_output[] = '<' . $tag . '>' . $value . '' . $tag . '>';
+}
+
/**
* Rollback a migrations.
*
diff --git a/examples/import/baseline_content_example.panelizer.default.xml b/examples/import/baseline_content_example.panelizer.default.xml
new file mode 100644
index 0000000..28fe53e
--- /dev/null
+++ b/examples/import/baseline_content_example.panelizer.default.xml
@@ -0,0 +1,573 @@
+
+
+
+ node:page:default
+
+ a:2:{s:6:"status";i:1;s:10:"view modes";a:3:{s:12:"page_manager";a:3:{s:6:"status";i:1;s:7:"default";i:1;s:6:"choice";i:1;}s:7:"default";a:3:{s:6:"status";i:0;s:7:"default";i:0;s:6:"choice";i:0;}s:12:"minimal_link";a:3:{s:6:"status";i:0;s:7:"default";i:0;s:6:"choice";i:0;}}}
+
+
+
+ node:page:default
+ Standaard
+ node
+ page
+ 0
+
+
+ ipe
+ a:0:{}
+ a:0:{}
+ a:0:{}
+ page_manager
+
+ H2
+ 1
+ a:0:{}
+
+
+
+
+ landing_level3
+ a:0:{}
+ a:1:{s:14:"style_settings";a:5:{s:7:"default";N;s:4:"left";N;s:6:"middle";N;s:5:"right";N;s:6:"bottom";N;}}
+ a:0:{}
+ %node:title
+ 0
+ 706
+ 8a564d70-f7bf-4cb2-8f36-4025722302d6
+
+
+
+ middle
+ entity_field
+ node:field_page_intro
+ 1
+ a:0:{}
+ a:7:{s:5:"label";s:6:"hidden";s:9:"formatter";s:12:"text_default";s:11:"delta_limit";i:0;s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";b:0;s:18:"formatter_settings";a:0:{}s:7:"context";s:9:"panelizer";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 3
+ a:0:{}
+ 49131e52-56c2-4381-ba97-0452d811cb99
+
+
+ middle
+ entity_field
+ node:field_page_body
+ 1
+ a:0:{}
+ a:7:{s:5:"label";s:6:"hidden";s:9:"formatter";s:12:"text_default";s:11:"delta_limit";i:0;s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";b:0;s:18:"formatter_settings";a:0:{}s:7:"context";s:9:"panelizer";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 5
+ a:0:{}
+ 898c4276-3b82-4d86-b3b0-c65108770893
+
+
+ middle
+ entity_field
+ node:field_page_tool_nodes
+ 1
+ a:0:{}
+ a:7:{s:5:"label";s:6:"hidden";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";i:0;s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";b:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:6:"teaser";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 4
+ a:0:{}
+ e1f0b0d7-7c63-4121-abd5-715b63309542
+
+
+ middle
+ entity_field
+ node:field_page_infobox_nodes
+ 1
+ a:0:{}
+ a:7:{s:5:"label";s:6:"hidden";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";i:0;s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";b:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:6:"teaser";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 2
+ a:0:{}
+ cd3f032e-8116-4293-ab68-21135037e04c
+
+
+ right
+ entity_field
+ node:field_page_faq_nodes
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:12:"minimal_link";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ a4f96e2e-19d6-4555-963e-81d7442eaede
+
+
+ right
+ entity_field
+ node:field_page_publication_nodes
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:12:"minimal_link";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ 965877b6-95e8-4f34-9549-0246bc49f44e
+
+
+ right
+ entity_field
+ node:field_page_article_nodes
+ 1
+ a:0:{}
+ a:7:{s:5:"label";s:6:"hidden";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";i:0;s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";b:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:6:"teaser";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 2
+ a:0:{}
+ ba2fceac-94c3-4cb1-81ab-bda9e7d70b25
+
+
+ left
+ views
+ detail_page
+ 1
+ a:0:{}
+ a:15:{s:23:"override_pager_settings";i:0;s:9:"use_pager";i:0;s:14:"nodes_per_page";s:1:"1";s:8:"pager_id";s:1:"0";s:6:"offset";s:1:"0";s:9:"more_link";i:0;s:10:"feed_icons";i:0;s:10:"panel_args";i:0;s:12:"link_to_view";i:0;s:4:"args";s:0:"";s:3:"url";s:0:"";s:7:"display";s:5:"block";s:7:"context";a:1:{i:0;s:40:"panelizer.field_page_sitestructure_terms";}s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 9e9f7ede-8be5-4143-b4ef-0c3a57ccefe4
+
+
+ left
+ block
+ feature_navigation-feature_navigation_primary_sub
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ e8456cd8-ee79-465a-afdd-f3aa63559b69
+
+
+ left
+ block
+ feature_navigation-feature_navigation_second_sub
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 2
+ a:0:{}
+ 3088c739-d7bb-4672-82e4-78621a8555b1
+
+
+ middle
+ page_breadcrumb
+ page_breadcrumb
+ 1
+ a:0:{}
+ a:7:{s:30:"panels_breadcrumbs_admin_title";s:0:"";s:24:"panels_breadcrumbs_state";i:0;s:25:"panels_breadcrumbs_titles";s:0:"";s:24:"panels_breadcrumbs_paths";s:0:"";s:23:"panels_breadcrumbs_home";i:0;s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ eb7a9c8e-0fe3-4315-9082-3786091de668
+
+
+ middle
+ page_title
+ page_title
+ 1
+ a:0:{}
+ a:5:{s:6:"markup";s:2:"h1";s:5:"class";s:0:"";s:2:"id";s:0:"";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ 32df7f89-8ee1-4855-bded-bba55f66c826
+
+
+
+
+
+ node:themepage:default
+
+ a:2:{s:6:"status";i:1;s:10:"view modes";a:4:{s:12:"page_manager";a:3:{s:6:"status";i:1;s:7:"default";i:1;s:6:"choice";i:1;}s:7:"default";a:3:{s:6:"status";i:0;s:7:"default";i:0;s:6:"choice";i:0;}s:6:"teaser";a:3:{s:6:"status";i:0;s:7:"default";i:0;s:6:"choice";i:0;}s:12:"minimal_link";a:3:{s:6:"status";i:0;s:7:"default";i:0;s:6:"choice";i:0;}}}
+
+
+
+ node:themepage:default
+ Standaard
+ node
+ themepage
+ 0
+
+
+ ipe
+ a:0:{}
+ a:1:{i:0;a:6:{s:10:"identifier";s:89:"Taxonomy term from Content (on Content: Site structure [field_tpage_sitestructure_terms])";s:7:"keyword";s:13:"taxonomy_term";s:4:"name";s:68:"entity_from_field:field_tpage_sitestructure_terms-node-taxonomy_term";s:5:"delta";i:0;s:7:"context";s:9:"panelizer";s:2:"id";i:1;}}
+ a:0:{}
+ page_manager
+
+ H2
+ 1
+ a:4:{s:24:"panels_breadcrumbs_state";i:0;s:25:"panels_breadcrumbs_titles";s:0:"";s:24:"panels_breadcrumbs_paths";s:0:"";s:23:"panels_breadcrumbs_home";i:1;}
+
+
+
+
+ landing_level2
+ a:0:{}
+ a:1:{s:14:"style_settings";a:5:{s:7:"default";N;s:3:"top";N;s:11:"center_left";N;s:12:"center_right";N;s:6:"bottom";N;}}
+ a:0:{}
+ %node:title
+ 0
+ 0
+ 78be8afb-8235-4e30-9946-decb3896fdda
+
+
+
+ top
+ entity_field
+ node:field_tpage_researchlinks
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:12:"minimal_link";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ e1167c1a-9f01-4c86-a54c-e34fdce0f398
+
+
+ top
+ entity_field
+ node:field_tpage_tool_nodes
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:6:"teaser";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 2
+ a:0:{}
+ 7f2fb563-1989-464e-9caf-7a048840b6b4
+
+
+ center_right
+ entity_field
+ node:field_tpage_publication_nodes
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:12:"minimal_link";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ e21832ff-2ef5-4d6d-bf40-9d19fdf6145b
+
+
+ bottom
+ views
+ articles
+ 1
+ a:0:{}
+ a:15:{s:23:"override_pager_settings";i:0;s:9:"use_pager";i:0;s:14:"nodes_per_page";s:1:"4";s:8:"pager_id";s:1:"0";s:6:"offset";s:1:"0";s:9:"more_link";i:0;s:10:"feed_icons";i:0;s:10:"panel_args";i:0;s:12:"link_to_view";i:0;s:4:"args";s:0:"";s:3:"url";s:0:"";s:7:"display";s:21:"theme_latest_articles";s:7:"context";a:1:{i:0;s:41:"panelizer.field_tpage_sitestructure_terms";}s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 1a37b3e0-ea4d-482b-858a-7d82aa01f3b0
+
+
+ top
+ entity_field
+ node:field_tpage_intro
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:6:"hidden";s:9:"formatter";s:12:"text_default";s:11:"delta_limit";i:0;s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";b:0;s:18:"formatter_settings";a:0:{}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 0833ca72-6cc1-431b-a6b6-a5bd2bffb54f
+
+
+ center_left
+ block
+ feature_navigation-feature_navigation_primary_subf
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ d85cdb83-e374-4e3c-b705-1c95a306a4b8
+
+
+ center_middle
+ block
+ feature_navigation-feature_navigation_primary_subs
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 14ee9048-68eb-435b-92e0-b455544b3f99
+
+
+ bottom_below_left
+ block
+ bean-op-zoek-naar-informatie-op-uw-ad
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 2de95fc1-849e-4e67-a449-8619bb40b544
+
+
+ bottom_below°right
+ block
+ bean-vraag-het-aan-foo
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 8d187263-a913-4444-8fca-3ade054c9e89
+
+
+ bottom_below°right
+ block
+ bean-veelgestelde-vragen
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ e11369e8-7ef9-4cb6-9c05-b96840e07d61
+
+
+
+
+
+ node:landingpage:default
+
+ a:2:{s:6:"status";i:1;s:10:"view modes";a:4:{s:12:"page_manager";a:3:{s:6:"status";i:1;s:7:"default";i:1;s:6:"choice";i:1;}s:7:"default";a:3:{s:6:"status";i:0;s:7:"default";i:0;s:6:"choice";i:0;}s:6:"teaser";a:3:{s:6:"status";i:0;s:7:"default";i:0;s:6:"choice";i:0;}s:12:"minimal_link";a:3:{s:6:"status";i:0;s:7:"default";i:0;s:6:"choice";i:0;}}}
+
+
+
+ node:landingpage:default
+ Standaard
+ node
+ landingpage
+ 0
+
+
+ ipe
+ a:0:{}
+ a:1:{i:0;a:6:{s:10:"identifier";s:89:"Taxonomy term from Content (on Content: Site structure [field_lpage_sitestructure_terms])";s:7:"keyword";s:13:"taxonomy_term";s:4:"name";s:68:"entity_from_field:field_lpage_sitestructure_terms-node-taxonomy_term";s:5:"delta";i:0;s:7:"context";s:9:"panelizer";s:2:"id";i:1;}}
+ a:0:{}
+ page_manager
+
+ H2
+ 1
+ a:0:{}
+
+
+
+
+ landing_level1
+ a:0:{}
+ a:1:{s:14:"style_settings";a:7:{s:7:"default";N;s:8:"top_left";N;s:9:"top_right";N;s:11:"center_left";N;s:13:"center_middle";N;s:12:"center_right";N;s:6:"bottom";N;}}
+ a:0:{}
+ %node:title
+ 1
+ 0
+ 83ac2230-2f27-42e3-a363-8dd0e8743289
+
+
+
+ center_left
+ block
+ bean-op-zoek-naar-informatie-op-uw-ad
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:2:{s:6:"css_id";s:0:"";s:9:"css_class";s:13:"category-list";}
+ a:0:{}
+ 0
+ a:0:{}
+ 1798f747-f45e-449a-92d2-99a31b6390db
+
+
+ center_middle
+ block
+ bean-vraag-het-aan-foo
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:2:{s:6:"css_id";s:0:"";s:9:"css_class";s:22:"category-list question";}
+ a:0:{}
+ 0
+ a:0:{}
+ 8089ede0-6528-4df1-8327-b476301d4cb8
+
+
+ center_middle
+ block
+ bean-klacht-of-opmerking
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:2:{s:6:"css_id";s:0:"";s:9:"css_class";s:30:"category-list complaint-remark";}
+ a:0:{}
+ 1
+ a:0:{}
+ a0a34b3e-a973-41b2-80f3-ddf98bb28c29
+
+
+ center_right
+ block
+ bean-defecte-straatlampen
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:2:{s:6:"css_id";s:0:"";s:9:"css_class";s:33:"category-list broken-streetlights";}
+ a:0:{}
+ 0
+ a:0:{}
+ 6e065aed-d891-414e-8210-59176b199290
+
+
+ top_left
+ views
+ primary_themes
+ 1
+ a:0:{}
+ a:15:{s:23:"override_pager_settings";i:0;s:9:"use_pager";i:0;s:14:"nodes_per_page";s:1:"0";s:8:"pager_id";s:1:"0";s:6:"offset";s:1:"0";s:9:"more_link";i:0;s:10:"feed_icons";i:0;s:10:"panel_args";i:0;s:12:"link_to_view";i:0;s:4:"args";s:0:"";s:3:"url";s:0:"";s:7:"display";s:7:"block_1";s:7:"context";a:1:{i:0;s:0:"";}s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 6114e238-1731-49cb-a1dc-6774ee327bc0
+
+
+ top_right
+ entity_field
+ node:field_lpage_quicklinks
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:12:"minimal_link";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ ba42b933-f559-4869-b2d9-71d21b6cbb02
+
+
+ bottom
+ views
+ articles
+ 1
+ a:0:{}
+ a:14:{s:23:"override_pager_settings";i:0;s:9:"use_pager";i:0;s:14:"nodes_per_page";s:1:"4";s:8:"pager_id";s:1:"0";s:6:"offset";s:1:"0";s:9:"more_link";i:0;s:10:"feed_icons";i:0;s:10:"panel_args";i:0;s:12:"link_to_view";i:0;s:4:"args";s:0:"";s:3:"url";s:0:"";s:7:"display";s:24:"sitewide_latest_articles";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ caf9a178-a184-4fcc-b3dc-a7593bafe248
+
+
+ top_right
+ block
+ bean-dringende-oproepen
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ 1bb79e62-85a0-451b-9102-6e267bed64cf
+
+
+
+
+
diff --git a/examples/import/baseline_content_example.panelizer.entity.xml b/examples/import/baseline_content_example.panelizer.entity.xml
new file mode 100644
index 0000000..005c9e1
--- /dev/null
+++ b/examples/import/baseline_content_example.panelizer.entity.xml
@@ -0,0 +1,518 @@
+
+
+
+ [themepage] Lorem ipsum
+ Lorem ipsum
+
+
+ node
+ NULL
+ 0
+
+
+ ipe
+ a:0:{}
+ a:1:{i:0;a:6:{s:10:"identifier";s:89:"Taxonomy term from Content (on Content: Site structure [field_tpage_sitestructure_terms])";s:7:"keyword";s:13:"taxonomy_term";s:4:"name";s:68:"entity_from_field:field_tpage_sitestructure_terms-node-taxonomy_term";s:5:"delta";i:0;s:7:"context";s:9:"panelizer";s:2:"id";i:1;}}
+ page_manager
+
+ H2
+ 1
+ a:4:{s:24:"panels_breadcrumbs_state";i:0;s:25:"panels_breadcrumbs_titles";s:0:"";s:24:"panels_breadcrumbs_paths";s:0:"";s:23:"panels_breadcrumbs_home";i:1;}
+
+
+
+
+ landing_level2
+ a:0:{}
+ a:1:{s:14:"style_settings";a:5:{s:7:"default";N;s:3:"top";N;s:11:"center_left";N;s:12:"center_right";N;s:6:"bottom";N;}}
+ a:0:{}
+ %node:title
+ 0
+ 0
+ 78be8afb-8235-4e30-9946-decb3896fdda
+
+
+
+ top
+ entity_field
+ node:field_tpage_intro
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:6:"hidden";s:9:"formatter";s:12:"text_default";s:11:"delta_limit";i:0;s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";b:0;s:18:"formatter_settings";a:0:{}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 0833ca72-6cc1-431b-a6b6-a5bd2bffb54f
+
+
+ top
+ entity_field
+ node:field_tpage_researchlinks
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:12:"minimal_link";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ e1167c1a-9f01-4c86-a54c-e34fdce0f398
+
+
+ top
+ entity_field
+ node:field_tpage_tool_nodes
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:6:"teaser";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 2
+ a:0:{}
+ 7f2fb563-1989-464e-9caf-7a048840b6b4
+
+
+ center_left
+ block
+ feature_navigation-feature_navigation_primary_subf
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ d85cdb83-e374-4e3c-b705-1c95a306a4b8
+
+
+ center_middle
+ block
+ feature_navigation-feature_navigation_primary_subs
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 14ee9048-68eb-435b-92e0-b455544b3f99
+
+
+ center_right
+ entity_field
+ node:field_tpage_publication_nodes
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:12:"minimal_link";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ e21832ff-2ef5-4d6d-bf40-9d19fdf6145b
+
+
+ bottom_below_left
+ block
+ bean-op-zoek-naar-informatie-op-uw-ad
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 2de95fc1-849e-4e67-a449-8619bb40b544
+
+
+ bottom_below°right
+ block
+ bean-vraag-het-aan-energy
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 8d187263-a913-4444-8fca-3ade054c9e89
+
+
+ bottom_below°right
+ block
+ bean-veelgestelde-vragen
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ e11369e8-7ef9-4cb6-9c05-b96840e07d61
+
+
+
+
+
+ [themepage] Jobs
+ Jobs
+
+
+ node
+ NULL
+ 0
+
+
+ ipe
+ a:0:{}
+ a:1:{i:0;a:6:{s:10:"identifier";s:89:"Taxonomy term from Content (on Content: Site structure [field_tpage_sitestructure_terms])";s:7:"keyword";s:13:"taxonomy_term";s:4:"name";s:68:"entity_from_field:field_tpage_sitestructure_terms-node-taxonomy_term";s:5:"delta";i:0;s:7:"context";s:9:"panelizer";s:2:"id";i:1;}}
+ page_manager
+
+ H2
+ 1
+ a:4:{s:24:"panels_breadcrumbs_state";i:0;s:25:"panels_breadcrumbs_titles";s:0:"";s:24:"panels_breadcrumbs_paths";s:0:"";s:23:"panels_breadcrumbs_home";i:1;}
+
+
+
+
+ landing_level2_twocol
+ a:0:{}
+ a:1:{s:14:"style_settings";a:5:{s:7:"default";N;s:3:"top";N;s:11:"center_left";N;s:12:"center_right";N;s:6:"bottom";N;}}
+ a:0:{}
+ %node:title
+ 0
+ 0
+ 78be8afb-8235-4e30-9946-decb3896fdda
+
+
+
+ top
+ entity_field
+ node:field_tpage_intro
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:6:"hidden";s:9:"formatter";s:12:"text_default";s:11:"delta_limit";i:0;s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";b:0;s:18:"formatter_settings";a:0:{}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 0833ca72-6cc1-431b-a6b6-a5bd2bffb54f
+
+
+ top
+ entity_field
+ node:field_tpage_researchlinks
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:12:"minimal_link";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ e1167c1a-9f01-4c86-a54c-e34fdce0f398
+
+
+ top
+ entity_field
+ node:field_tpage_tool_nodes
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:6:"teaser";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 2
+ a:0:{}
+ 7f2fb563-1989-464e-9caf-7a048840b6b4
+
+
+ center_left
+ block
+ feature_navigation-feature_navigation_primary_sub
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 7eb07da2-84c5-4fb3-beb7-16232f21ef11
+
+
+ center_right
+ block
+ bean-energy-jobs-en-social-media
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 77cf9582-d686-4dde-8600-5743641118e5
+
+
+
+
+
+ [landingpage] Partner
+ Partner
+
+
+ node
+ NULL
+ 0
+
+
+ ipe
+ a:0:{}
+ a:1:{i:0;a:6:{s:10:"identifier";s:89:"Taxonomy term from Content (on Content: Site structure [field_lpage_sitestructure_terms])";s:7:"keyword";s:13:"taxonomy_term";s:4:"name";s:68:"entity_from_field:field_lpage_sitestructure_terms-node-taxonomy_term";s:5:"delta";i:0;s:7:"context";s:9:"panelizer";s:2:"id";i:1;}}
+ page_manager
+
+ H2
+ 1
+ a:0:{}
+
+
+
+
+ landing_level1
+ a:0:{}
+ a:1:{s:14:"style_settings";a:7:{s:7:"default";N;s:8:"top_left";N;s:9:"top_right";N;s:11:"center_left";N;s:13:"center_middle";N;s:12:"center_right";N;s:6:"bottom";N;}}
+ a:0:{}
+ %node:title
+ 1
+ 0
+ 83ac2230-2f27-42e3-a363-8dd0e8743289
+
+
+
+ top_left
+ views
+ primary_themes
+ 1
+ a:0:{}
+ a:15:{s:23:"override_pager_settings";i:0;s:9:"use_pager";i:0;s:14:"nodes_per_page";s:1:"0";s:8:"pager_id";s:1:"0";s:6:"offset";s:1:"0";s:9:"more_link";i:0;s:10:"feed_icons";i:0;s:10:"panel_args";i:0;s:12:"link_to_view";i:0;s:4:"args";s:0:"";s:3:"url";s:0:"";s:7:"display";s:7:"block_1";s:7:"context";a:1:{i:0;s:0:"";}s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 6114e238-1731-49cb-a1dc-6774ee327bc0
+
+
+ top_right
+ entity_field
+ node:field_lpage_quicklinks
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:12:"minimal_link";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ ba42b933-f559-4869-b2d9-71d21b6cbb02
+
+
+ center_left
+ block
+ bean-staat-u-in-het-onderwijs
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 10095fd5-45a7-4f8a-be5a-12d7297a39e6
+
+
+ center_middle
+ block
+ bean-vraag-het-aan-energy
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:2:{s:6:"css_id";s:0:"";s:9:"css_class";s:22:"category-list question";}
+ a:0:{}
+ 0
+ a:0:{}
+ 8089ede0-6528-4df1-8327-b476301d4cb8
+
+
+ center_middle
+ block
+ bean-klacht-of-opmerking
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:2:{s:6:"css_id";s:0:"";s:9:"css_class";s:30:"category-list complaint-remark";}
+ a:0:{}
+ 1
+ a:0:{}
+ a0a34b3e-a973-41b2-80f3-ddf98bb28c29
+
+
+ center_right
+ block
+ bean-defecte-straatlampen
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:2:{s:6:"css_id";s:0:"";s:9:"css_class";s:33:"category-list broken-streetlights";}
+ a:0:{}
+ 0
+ a:0:{}
+ 6e065aed-d891-414e-8210-59176b199290
+
+
+ top_right
+ block
+ bean-dringende-oproepen
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ 8b353a14-6117-4e5d-a965-334c8ec7f706
+
+
+
+
+
+ [landingpage] Over Lorem ipsum
+ Over Lorem ipsum
+
+
+ node
+ NULL
+ 0
+
+
+ ipe
+ a:0:{}
+ a:1:{i:0;a:6:{s:10:"identifier";s:89:"Taxonomy term from Content (on Content: Site structure [field_lpage_sitestructure_terms])";s:7:"keyword";s:13:"taxonomy_term";s:4:"name";s:68:"entity_from_field:field_lpage_sitestructure_terms-node-taxonomy_term";s:5:"delta";i:0;s:7:"context";s:9:"panelizer";s:2:"id";i:1;}}
+ page_manager
+
+ H2
+ 1
+ a:0:{}
+
+
+
+
+ landing_level1
+ a:0:{}
+ a:1:{s:14:"style_settings";a:7:{s:7:"default";N;s:8:"top_left";N;s:9:"top_right";N;s:11:"center_left";N;s:13:"center_middle";N;s:12:"center_right";N;s:6:"bottom";N;}}
+ a:0:{}
+ %node:title
+ 1
+ 0
+ 83ac2230-2f27-42e3-a363-8dd0e8743289
+
+
+
+ top_left
+ views
+ primary_themes
+ 1
+ a:0:{}
+ a:15:{s:23:"override_pager_settings";i:0;s:9:"use_pager";i:0;s:14:"nodes_per_page";s:1:"0";s:8:"pager_id";s:1:"0";s:6:"offset";s:1:"0";s:9:"more_link";i:0;s:10:"feed_icons";i:0;s:10:"panel_args";i:0;s:12:"link_to_view";i:0;s:4:"args";s:0:"";s:3:"url";s:0:"";s:7:"display";s:7:"block_1";s:7:"context";a:1:{i:0;s:0:"";}s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ 6114e238-1731-49cb-a1dc-6774ee327bc0
+
+
+ top_right
+ entity_field
+ node:field_lpage_quicklinks
+ 1
+ a:0:{}
+ a:9:{s:5:"label";s:5:"above";s:9:"formatter";s:27:"entityreference_entity_view";s:11:"delta_limit";s:1:"0";s:12:"delta_offset";s:1:"0";s:14:"delta_reversed";i:0;s:18:"formatter_settings";a:2:{s:9:"view_mode";s:12:"minimal_link";s:5:"links";i:1;}s:7:"context";s:9:"panelizer";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 0
+ a:0:{}
+ ba42b933-f559-4869-b2d9-71d21b6cbb02
+
+
+ top_right
+ block
+ bean-vraag-het-aan-energy
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 1
+ a:0:{}
+ c726bbe2-64f6-45f2-b073-a047a2dee527
+
+
+ top_right
+ block
+ bean-veelgestelde-vragen
+ 1
+ a:0:{}
+ a:2:{s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";}
+ a:0:{}
+
+ a:0:{}
+ a:0:{}
+ 2
+ a:0:{}
+ 8f9da6f9-7067-4e37-8c5f-1338fe211816
+
+
+
+
+
diff --git a/examples/migrations/baseline_content_example.panelizer.default.inc b/examples/migrations/baseline_content_example.panelizer.default.inc
new file mode 100644
index 0000000..8561207
--- /dev/null
+++ b/examples/migrations/baseline_content_example.panelizer.default.inc
@@ -0,0 +1,22 @@
+description = t('Import Panelizer default settings.');
+
+ $this->dependencies = array(
+ );
+ }
+
+ public function prepare(stdClass $page, stdClass $row) {
+
+ }
+
+ public function complete(stdClass $page, stdClass $row) {
+
+ }
+}
diff --git a/examples/migrations/baseline_content_example.panelizer.entity.inc b/examples/migrations/baseline_content_example.panelizer.entity.inc
new file mode 100644
index 0000000..91b15ef
--- /dev/null
+++ b/examples/migrations/baseline_content_example.panelizer.entity.inc
@@ -0,0 +1,29 @@
+description = t('Import Panelizer entity settings.');
+
+ $this->dependencies = array(
+ 'BaselineContentExamplePanelizerDefaultMigration',
+ 'BaselineContentExampleNodeMigration',
+ );
+
+ $this->addFieldMapping('entity_title', 'entity_title')
+ ->xpath('entity_title')
+ ->sourceMigration($this->dependencies);
+ }
+
+ public function prepare(stdClass $page, stdClass $row) {
+
+ }
+
+ public function complete(stdClass $page, stdClass $row) {
+
+ }
+}
diff --git a/files/baseline_content.panelizer.inc b/files/baseline_content.panelizer.inc
new file mode 100644
index 0000000..0f26be0
--- /dev/null
+++ b/files/baseline_content.panelizer.inc
@@ -0,0 +1,369 @@
+ "
This form lets you export this Drupal site's Panelizer settings, for re-import on another environment using the Baseline Content module.
+ Note that you will need to properly configure the source migration for your Panelizer Entities' migration handler.
+ For an example on how this is done, see the \"examples\" folder in the baseline_content module.
"
+ );
+ $default_options = baseline_content_panelizer_get_defaults_options();
+ $entities_options = baseline_content_panelizer_get_entities_options();
+ $form['panelizer_defaults'] = array(
+ '#type' => 'checkboxes',
+ '#options' => $default_options,
+ '#title' => t('Panelizer Defaults'),
+ '#default_value' => array_flip($default_options),
+ );
+ $form['panelizer_entity'] = array(
+ '#type' => 'checkboxes',
+ '#options' => $entities_options,
+ '#title' => t('Panelizer Entities'),
+ '#default_value' => array_flip($entities_options),
+ );
+ $form['submit_button'] = array(
+ '#type' => 'submit',
+ '#value' => t('Export selected settings'),
+ );
+ return $form;
+}
+
+/**
+ * @return array A list of Panelizer defaults. Key is the panel's did,
+ * value is the name of the default settings (such as node:page:default).
+ */
+function baseline_content_panelizer_get_defaults_options() {
+ $query = db_select('panelizer_defaults', 'pd');
+ $query->fields('pd', array('name', 'did'));
+ $query->condition('pd.name', 'NULL', '<>');
+ $result = $query->execute();
+ $output = array();
+ // Panelizer sometimes saves multiple versions of the same default layout.
+ // We're only interested in the latest one.
+ foreach ($result as $record) {
+ $output[$record->name] = $record->did;
+ }
+ return array_flip($output);
+}
+
+/**
+ * @return array A list of Panelizer entities. Key is the entity's ID,
+ * value is the content type of the entity followed by its title.
+ */
+function baseline_content_panelizer_get_entities_options() {
+ $query = db_select('panelizer_entity', 'pe');
+ $query->fields('pe', array('entity_id'));
+ $result = $query->execute();
+ $output = array();
+ // Panelizer sometimes saves multiple versions of the same default layout.
+ // We're only interested in the latest one.
+ foreach ($result as $record) {
+ $node = node_load($record->entity_id);
+
+ $output['[' . $node->type . '] ' . $node->title] = $record->entity_id;
+ }
+ return array_flip($output);
+}
+
+/**
+ * Make sure at least one checkbox is checked.
+ */
+function baseline_content_panelizer_input_form_validate($form, &$form_state) {
+ $at_least_one_value = FALSE;
+ foreach ($form_state['values']['panelizer_defaults'] as $value) {
+ if (!empty($value)) {
+ $at_least_one_value = TRUE;
+ }
+ }
+ foreach ($form_state['values']['panelizer_entity'] as $value) {
+ if (!empty($value)) {
+ $at_least_one_value = TRUE;
+ }
+ }
+ if(!$at_least_one_value) {
+ form_error($form, t('Please select at least one value.'));
+ }
+}
+
+/**
+ * Redirect the user to the export page. Panelizer defaults and entities
+ * are passed as a querystring, seperated by underscores.
+ */
+function baseline_content_panelizer_input_form_submit($form, &$form_state) {
+ $panelizer_defaults = baseline_content_panelizer_parse_input_to_querystring('panelizer_defaults', $form_state);
+ $panelizer_entity = baseline_content_panelizer_parse_input_to_querystring('panelizer_entity', $form_state);
+ drupal_goto('admin/config/content/baseline_content/panelizer/export/xml', array(
+ 'query' => array(
+ 'panelizer_defaults' => $panelizer_defaults,
+ 'panelizer_entity' => $panelizer_entity,
+ ),
+ ));
+}
+
+/**
+ * Grab the IDs from the given inputform and turn them into querystring parameters.
+ * Adds underscores when there's more than one ID.
+ */
+function baseline_content_panelizer_parse_input_to_querystring($output_type, &$form_state) {
+ $output = '';
+ $first = 0;
+ foreach ($form_state['values'][$output_type] as $value) {
+ if (!empty($value)) {
+ if ($first++ != 0) {
+ $output .= '_';
+ }
+ $output .= $value;
+ }
+ }
+ return $output;
+}
+
+/**
+ * The output page. Output is displayed in textareas, which makes it
+ * easier to copy-paste the text.
+ */
+function baseline_content_panelizer_export_form($form, &$form_state) {
+ $form['help_text'] = array(
+ '#markup' => 'Copy-paste the output into the import file used by your Baseline Content migration process.
+ For an example of how these are used, see the "examples" folder in the baseline_content module.
'
+ );
+ $output = baseline_content_panelizer_generate_output('panelizer_defaults');
+ baseline_content_panelizer_render_output($output, 'panelizer_defaults', $form);
+
+ $output = baseline_content_panelizer_generate_output('panelizer_entity');
+ baseline_content_panelizer_render_output($output, 'panelizer_entity', $form);
+ return $form;
+}
+
+/**
+ * Base function to generate XML for both defaults and entities.
+ * @param $output_type string Can be either 'panelizer_defaults' or 'panelizer_entity'.
+ * @return array A list of XML nodes.
+ */
+function baseline_content_panelizer_generate_output($output_type) {
+ $output = array();
+ $querystring = drupal_get_query_parameters();
+ if (!empty($querystring[$output_type])) {
+ $ids = explode('_', $querystring[$output_type]);
+ }
+ if (!empty($ids)) {
+ $output[] = '';
+ $output[] = '';
+ foreach ($ids as $id) {
+ $output[] = '';
+ if ($output_type == 'panelizer_defaults') {
+ baseline_content_panelizer_add_defaults($output, $id);
+ baseline_content_panelizer_add_panel_settings($output, $id);
+ }
+ else if ($output_type == 'panelizer_entity') {
+ baseline_content_panelizer_add_entities($output, $id);
+ }
+ $output[] = '';
+ }
+ $output[] = '';
+ }
+ return $output;
+}
+
+/**
+ * Takes a list of XML nodes and renders them on a form field.
+ * Indentation is added to make the output (slightly) easier to read.
+ */
+function baseline_content_panelizer_render_output($output_array, $output_type, &$form) {
+ $indent = 0;
+ $output_text = '';
+ foreach ($output_array as $index => $node) {
+ if ($index == 1) {
+ // Do not indent the second line, since the tag is above it.
+ }
+ else {
+ if (strpos($node, '') === 0) {
+ // If this XML node is a closing tag, reduce the indent.
+ $indent -= 2;
+ }
+ else if ($index != 0) {
+ // If this XML node is not a closing tag and is not the first line:
+ if (strpos($output_array[$index - 1], '') === 0) {
+ // If the previous XML node is a closing tag, reduce the indent.
+ $indent -= 2;
+ }
+ if (strpos($output_array[$index - 1], '')) {
+ // If the previous XML node contains both an opening and a closing tag,
+ // (such as value), keep the indent the same.
+ }
+ else {
+ // If the previous XML node is an opening tag, increase the indent.
+ $indent += 2;
+ }
+ }
+ $count = $indent;
+ $spaces = '';
+ if ($count > 0) {
+ while ($count--) {
+ $spaces .= ' ';
+ }
+ }
+ }
+ $output_text .= $spaces . $node . "\n";
+ }
+ if ($output_type == 'panelizer_entity') {
+ $form['panelizer_entity'] = array(
+ '#type' => 'textarea',
+ '#title' => t('Panelizer Entity output'),
+ '#default_value' => $output_text,
+ );
+ }
+ if ($output_type == 'panelizer_defaults') {
+ $form['panelizer_defaults'] = array(
+ '#type' => 'textarea',
+ '#title' => t('Panelizer Defaults output'),
+ '#default_value' => $output_text,
+ );
+ }
+}
+
+/**
+ * Adds the and the XML
+ * to the Panelizer Defaults output.
+ */
+function baseline_content_panelizer_add_defaults(&$output, $did) {
+ $query = db_select('panelizer_defaults', 'pdef');
+ $query->fields('pdef', array( 'name', 'title', 'panelizer_type', 'panelizer_key', 'no_blocks', 'css_id', 'css', 'pipeline', 'contexts', 'relationships', 'access', 'view_mode', 'css_class', 'title_element', 'link_to_entity', 'extra'));
+ $query->condition('pdef.did', $did);
+ $query->condition('pdef.name', 'NULL', '<>');
+ $result = $query->execute();
+ foreach ($result as $record) {
+ // Should only be 1.
+ baseline_content_xml_add_single($output, 'description', $record->name);
+ baseline_content_panelizer_add_variables($output, $record);
+ $output[] = '';
+ baseline_content_panelizer_add_defaults_settings($output, $record);
+ $output[] = '';
+ }
+}
+
+/**
+ * Adds the XML to the Panelizer Defaults output.
+ */
+function baseline_content_panelizer_add_defaults_settings(&$output, $record) {
+ $output[] = '';
+ foreach ($record as $key => $value) {
+ baseline_content_xml_add_single($output, $key, $value);
+ }
+ $output[] = '';
+}
+
+/**
+ * Adds the XML to the Panelizer Entities output.
+ */
+function baseline_content_panelizer_add_entities(&$output, $entity_id) {
+ $query = db_select('panelizer_entity', 'pe');
+ $query->fields('pe', array( 'did', 'entity_id', 'revision_id', 'entity_type', 'name', 'no_blocks', 'css_id', 'css', 'pipeline', 'contexts', 'relationships', 'view_mode', 'css_class', 'title_element', 'link_to_entity', 'extra'));
+ $query->condition('pe.entity_id', $entity_id);
+ $result = $query->execute();
+ // Only grab the latest revision.
+ // TODO: Add revision support.
+ $highest_revision = array();
+ foreach ($result as $record) {
+ $highest_revision[$record->entity_id] = $record->revision_id;
+ }
+ // TODO: don't execute this query twice.
+ $result = $query->execute();
+ foreach ($result as $record) {
+ foreach ($highest_revision as $nid => $rid) {
+ if ($record->entity_id == $nid && $record->revision_id == $rid) {
+ $did = $record->did;
+ $node = node_load($record->entity_id);
+ baseline_content_xml_add_single($output, 'description', '[' . $node->type . '] ' . $node->title);
+ baseline_content_xml_add_single($output, 'entity_title', $node->title);
+ unset($record->entity_id);
+ unset($record->revision_id);
+ unset($record->did);
+ $output[] = '';
+ baseline_content_panelizer_add_entities_settings($output, $record);
+ $output[] = '';
+ baseline_content_panelizer_add_panel_settings($output, $did);
+ }
+ }
+ }
+}
+
+
+/**
+ * Adds the XML to the Panelizer Entities output.
+ */
+function baseline_content_panelizer_add_entities_settings(&$output, $record) {
+ $output[] = '';
+ foreach ($record as $key => $value) {
+ // The key "name" is peculiar. The database stores this as string "NULL".
+ // To prevent inconsistencies when the value is empty, we'll output "NULL".
+ if ($key == 'name' && empty($value)) {
+ $value = 'NULL';
+ }
+ baseline_content_xml_add_single($output, $key, $value);
+ }
+ $output[] = '';
+}
+
+/**
+ * Adds the XML to the Panelizer Defaults output.
+ */
+function baseline_content_panelizer_add_variables(&$output, $record) {
+ $output[] = '';
+ // Panelizer stores a variable for Defaults, which further dictates their settings.
+ // We need to include this in the export file.
+ $variable = serialize(variable_get('panelizer_defaults_node_' . $record->panelizer_key));
+ $output[] = 'panelizer_key . '>' . $variable . 'panelizer_key . '>';
+ $output[] = '';
+}
+
+/**
+ * Adds the XML to the Panelizer Defaults & Entities output.
+ */
+function baseline_content_panelizer_add_panel_settings(&$output, $did) {
+ $output[] = '';
+ baseline_content_panelizer_add_panels_display($output, $did);
+ baseline_content_panelizer_add_panels_pane($output, $did);
+ $output[] = '';
+}
+
+/**
+ * Adds the XML to the Panelizer Defaults & Entities output.
+ */
+function baseline_content_panelizer_add_panels_display(&$output, $did) {
+ $output[] = '';
+ $query = db_select('panels_display', 'pd');
+ $query->fields('pd', array( 'layout', 'layout_settings', 'panel_settings', 'cache', 'title', 'hide_title', 'title_pane', 'uuid'));
+ $query->condition('pd.did', $did);
+ $result = $query->execute();
+ foreach ($result as $record) {
+ // Should only be 1.
+ foreach ($record as $key => $value) {
+ baseline_content_xml_add_single($output, $key, $value);
+ }
+ }
+ $output[] = '';
+}
+
+/**
+ * Adds the XML to the Panelizer Defaults & Entities output.
+ */
+function baseline_content_panelizer_add_panels_pane(&$output, $did) {
+ $output[] = '';
+ $query = db_select('panels_pane', 'pp');
+ $query->fields('pp', array( 'panel', 'type', 'subtype', 'shown', 'access', 'configuration', 'cache', 'style', 'css', 'extras', 'position', 'locks', 'uuid'));
+ $query->condition('pp.did', $did);
+ $result = $query->execute();
+ foreach ($result as $record) {
+ // Can be multiple.
+ $output[] = '';
+ foreach ($record as $key => $value) {
+ baseline_content_xml_add_single($output, $key, $value);
+ }
+ $output[] = '';
+ }
+ $output[] = '';
+ return $output;
+}
diff --git a/migrations/baseline_content.panelizer.default.inc b/migrations/baseline_content.panelizer.default.inc
new file mode 100644
index 0000000..065221d
--- /dev/null
+++ b/migrations/baseline_content.panelizer.default.inc
@@ -0,0 +1,41 @@
+description = t('Import panelizer default settings.');
+
+ $this->map = new MigrateSQLMap($this->machineName,
+ array(
+ 'description' => array(
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ ),
+ ),
+ MigrateDestinationPanelizerDefault::getKeySchema()
+ );
+
+ $file = DRUPAL_ROOT . '/' . $import_file;
+ $fields = $this->getSourceFields();
+ $this->source = new MigrateSourceXML($file, '/panelizer/panelize', 'description', $fields);
+ $this->destination = new MigrateDestinationPanelizerDefault();
+ }
+
+ /**
+ * Returns an array of resource field definitions.
+ */
+ protected function getSourceFields() {
+ return array(
+ 'description' => t('Description'),
+ 'panel_settings' => t('Panel settings'),
+ 'panelizer_settings' => t('Panelizer settings'),
+ );
+ }
+}
diff --git a/migrations/baseline_content.panelizer.entity.inc b/migrations/baseline_content.panelizer.entity.inc
new file mode 100644
index 0000000..371bf5f
--- /dev/null
+++ b/migrations/baseline_content.panelizer.entity.inc
@@ -0,0 +1,42 @@
+description = t('Import panelizer entity settings.');
+
+ $this->map = new MigrateSQLMap($this->machineName,
+ array(
+ 'description' => array(
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ ),
+ ),
+ MigrateDestinationPanelizerEntity::getKeySchema()
+ );
+
+ $file = DRUPAL_ROOT . '/' . $import_file;
+ $fields = $this->getSourceFields();
+ $this->source = new MigrateSourceXML($file, '/panelizer/panelize', 'description', $fields);
+ $this->destination = new MigrateDestinationPanelizerEntity();
+ }
+
+ /**
+ * Returns an array of resource field definitions.
+ */
+ protected function getSourceFields() {
+ return array(
+ 'description' => t('Description'),
+ 'entity_title' => t('Entity title'),
+ 'panel_settings' => t('Panel settings'),
+ 'panelizer_settings' => t('Panelizer settings'),
+ );
+ }
+}
diff --git a/plugins/panelizer.default.inc b/plugins/panelizer.default.inc
new file mode 100755
index 0000000..fdb90d4
--- /dev/null
+++ b/plugins/panelizer.default.inc
@@ -0,0 +1,156 @@
+ t('Description'),
+ 'panel_settings' => t('Panel settings'),
+ 'panelizer_settings' => t('Panelizer settings'),
+ );
+ }
+
+ static public function getKeySchema() {
+ return array(
+ 'description' => array(
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ ),
+ );
+ }
+
+ /**
+ * Delete Panelizer Default settings.
+ */
+ public function rollback(array $panel_ids) {
+ foreach ($panel_ids as $panel_id) {
+ // Unset any variables that may have been set during import.
+ $variable_string = variable_get('baseline_content_variables_for_panel_' . $panel_id, '');
+ if (!empty($variable_string)) {
+ $variables = explode(',', $variable_string);
+ foreach ($variables as $variable) {
+ variable_del($variable);
+ }
+ variable_del('baseline_content_variables_for_panel_' . $panel_id);
+ }
+ db_delete('panelizer_defaults')
+ ->condition('did', $panel_id)
+ ->execute();
+ db_delete('panels_pane')
+ ->condition('did', $panel_id)
+ ->execute();
+ db_delete('panels_display')
+ ->condition('did', $panel_id)
+ ->execute();
+ }
+ }
+
+ /**
+ * Import a single panel.
+ */
+ public function import(stdClass $object, stdClass $row) {
+
+ // Updates aren't entirely supported yet, so rollback any previous
+ // migrations first.
+ if (!empty($row->migrate_map_destid1)) {
+ $this->rollback(array($row->migrate_map_destid1));
+ }
+ $panelizer_description = '' . $row->xml->description;
+
+ $migration = Migration::currentMigration();
+
+ $this->prepare($object, $row);
+
+ $fields = array(
+ 'panels_display' => array(),
+ 'panels_pane' => array(),
+ 'panelizer_defaults' => array(),
+ );
+ // Insert the panel display.
+ $panels_display_columns = (array) $row->xml->panel_settings->panels_display;
+ foreach ($panels_display_columns as $column_name => $value) {
+ $fields['panels_display'][$column_name] = $value;
+ }
+ $did = db_insert('panels_display')
+ ->fields($fields['panels_display'])
+ ->execute();
+
+ // This gives us a panel ID which we need for the panel panes.
+ $panes = (array) $row->xml->panel_settings->panels_pane;
+ foreach ($panes['pane'] as $pane) {
+ $id = count($fields['panels_pane']);
+ $fields['panels_pane'][$id] = array();
+ $pane_fields = (array) $pane;
+ foreach ($pane as $column_name => $value) {
+ $fields['panels_pane'][$id][$column_name] = $value;
+ }
+ $fields['panels_pane'][$id]['did'] = $did;
+ db_insert('panels_pane')
+ ->fields($fields['panels_pane'][$id])
+ ->execute();
+ }
+ // The panel ID also lets us insert the Panelizer defaults.
+ $panelizer_defaults_columns = (array) $row->xml->panelizer_settings->panelizer_defaults;
+ foreach ($panelizer_defaults_columns as $column_name => $value) {
+ $fields['panelizer_defaults'][$column_name] = $value;
+ }
+ $fields['panelizer_defaults']['did'] = $did;
+ db_insert('panelizer_defaults')
+ ->fields($fields['panelizer_defaults'])
+ ->execute();
+
+ // Set the panel's default settings.
+ if (!empty($row->xml->variables)) {
+ foreach ($row->xml->variables as $variables) {
+ $array = (array) $variables;
+ foreach ($array as $name => $variable) {
+ $variable = unserialize($variable);
+ variable_set($name, $variable);
+
+ // Set a variable to point to the imported panel's variables. This
+ // is needed to unset these variables upon rollback.
+ // TODO: refactor so an extra variable isn't needed.
+ $old_variable = variable_get('baseline_content_variables_for_panel_' . $did, '');
+ if (!empty($old_variable)) {
+ $old_variable = $old_variable . ',';
+ }
+ $new_variable = $old_variable . $name;
+ variable_set('baseline_content_variables_for_panel_' . $did, $new_variable);
+ }
+ }
+ }
+
+ $this->numCreated++;
+
+ return array($did);
+ }
+
+ public function prepare(stdClass $object, stdClass $row) {
+ $migration = Migration::currentMigration();
+ // Then call any prepare handler for this specific Migration.
+ if (method_exists($migration, 'prepare')) {
+ $migration->prepare($object, $row);
+ }
+ }
+
+ public function complete(stdClass $object, stdClass $source_row) {
+ $migration = Migration::currentMigration();
+ if (method_exists($migration, 'complete')) {
+ $migration->complete($object, $source_row);
+ }
+ }
+
+ /**
+ * Derived classes must implement __toString().
+ *
+ * @return string
+ * Description of the destination being migrated into
+ */
+ public function __toString() {
+ return 'MigrateDestinationPanelizerDefault';
+ }
+}
diff --git a/plugins/panelizer.entity.inc b/plugins/panelizer.entity.inc
new file mode 100755
index 0000000..3a5a88e
--- /dev/null
+++ b/plugins/panelizer.entity.inc
@@ -0,0 +1,136 @@
+ t('Description'),
+ 'entity_title' => t('Entity title'),
+ 'panel_settings' => t('Panel settings'),
+ 'panelizer_settings' => t('Panelizer settings'),
+ );
+ }
+
+ static public function getKeySchema() {
+ return array(
+ 'description' => array(
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ ),
+ );
+ }
+
+ /**
+ * Delete Panelizer settings for an entity.
+ */
+ public function rollback(array $panel_ids) {
+ foreach ($panel_ids as $panel_id) {
+ db_delete('panelizer_entity')
+ ->condition('did', $panel_id)
+ ->execute();
+ db_delete('panels_pane')
+ ->condition('did', $panel_id)
+ ->execute();
+ db_delete('panels_display')
+ ->condition('did', $panel_id)
+ ->execute();
+ }
+ }
+
+ /**
+ * Import a single panelized entity.
+ */
+ public function import(stdClass $object, stdClass $row) {
+ $node_id = $object->entity_title;
+ $node = node_load($node_id);
+ $revision_id = $node->vid;
+ // Updates aren't entirely supported yet, so rollback any previous
+ // migrations first.
+ if (!empty($row->migrate_map_destid1)) {
+ $this->rollback(array($row->migrate_map_destid1));
+ }
+ $panelizer_description = '' . $row->xml->description;
+
+ $migration = Migration::currentMigration();
+
+ $this->prepare($object, $row);
+
+ $fields = array(
+ 'panels_display' => array(),
+ 'panels_pane' => array(),
+ 'panelizer_entity' => array(),
+ );
+ // Insert the panel display.
+ $panels_display_columns = (array) $row->xml->panel_settings->panels_display;
+ foreach ($panels_display_columns as $column_name => $value) {
+ $fields['panels_display'][$column_name] = $value;
+ }
+ $did = db_insert('panels_display')
+ ->fields($fields['panels_display'])
+ ->execute();
+
+ // This gives us a panel ID which we need for the panel panes.
+ $panes = (array) $row->xml->panel_settings->panels_pane;
+ foreach ($panes['pane'] as $pane) {
+ $id = count($fields['panels_pane']);
+ $fields['panels_pane'][$id] = array();
+ $pane_fields = (array) $pane;
+ foreach ($pane as $column_name => $value) {
+ $fields['panels_pane'][$id][$column_name] = $value;
+ }
+ $fields['panels_pane'][$id]['did'] = $did;
+ db_insert('panels_pane')
+ ->fields($fields['panels_pane'][$id])
+ ->execute();
+ }
+ // The panel ID also lets us insert the Panelizer entity.
+ $panelizer_entity_columns = (array) $row->xml->panelizer_settings->panelizer_entity;
+ foreach ($panelizer_entity_columns as $column_name => $value) {
+ $fields['panelizer_entity'][$column_name] = $value;
+ }
+ $fields['panelizer_entity']['did'] = $did;
+ $fields['panelizer_entity']['entity_id'] = $node_id;
+ $fields['panelizer_entity']['revision_id'] = $revision_id;
+ db_insert('panelizer_entity')
+ ->fields($fields['panelizer_entity'])
+ ->execute();
+
+ $this->numCreated++;
+
+ return array($did);
+ }
+
+ public function prepare(stdClass $object, stdClass $row) {
+ $migration = Migration::currentMigration();
+ // Then call any prepare handler for this specific Migration.
+ if (method_exists($migration, 'prepare')) {
+ $migration->prepare($object, $row);
+ }
+ }
+
+ public function complete(stdClass $object, stdClass $source_row) {
+ $migration = Migration::currentMigration();
+ if (method_exists($migration, 'complete')) {
+ $migration->complete($object, $source_row);
+ }
+ }
+
+ /**
+ * Derived classes must implement __toString().
+ *
+ * @return string
+ * Description of the destination being migrated into
+ */
+ public function __toString() {
+ return 'MigrateDestinationPanelizerEntity';
+ }
+}