Skip to content

Commit

Permalink
Issue #8: Panelizer Defaults & Panelizer Entity migration handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
algeronwaterschoot committed Sep 12, 2014
1 parent 79af18f commit a37e87a
Show file tree
Hide file tree
Showing 11 changed files with 1,936 additions and 0 deletions.
4 changes: 4 additions & 0 deletions baseline_content.info
Original file line number Diff line number Diff line change
Expand Up @@ -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
46 changes: 46 additions & 0 deletions baseline_content.module
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
573 changes: 573 additions & 0 deletions examples/import/baseline_content_example.panelizer.default.xml

Large diffs are not rendered by default.

518 changes: 518 additions & 0 deletions examples/import/baseline_content_example.panelizer.entity.xml

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions examples/migrations/baseline_content_example.panelizer.default.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

class BaselineContentExamplePanelizerDefaultMigration extends BaselineContentPanelizerDefaultMigration {

public function __construct() {
$module_path = drupal_get_path('module', 'baseline_content_example');
$import_path = $module_path . '/examples/import/baseline_content_example.panelizer.default.xml';
parent::__construct($import_path);
$this->description = t('Import Panelizer default settings.');

$this->dependencies = array(
);
}

public function prepare(stdClass $page, stdClass $row) {

}

public function complete(stdClass $page, stdClass $row) {

}
}
29 changes: 29 additions & 0 deletions examples/migrations/baseline_content_example.panelizer.entity.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

class BaselineContentExamplePanelizerEntityMigration extends BaselineContentPanelizerEntityMigration {


public function __construct() {
$module_path = drupal_get_path('module', 'baseline_content_example');
$import_path = $module_path . '/examples/import/baseline_content_example.panelizer.entity.xml';
parent::__construct($import_path);
$this->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) {

}
}
Loading

0 comments on commit a37e87a

Please sign in to comment.