Skip to content

Commit

Permalink
Merge pull request #61 from kybersoft/migrate
Browse files Browse the repository at this point in the history
Add csgov_migrate module to provide content import and export.
  • Loading branch information
petrillek authored Jun 19, 2023
2 parents 91219fc + 71c40b3 commit 4df11d4
Show file tree
Hide file tree
Showing 70 changed files with 9,034 additions and 3 deletions.
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"drupal/menu_block": "^1.x-dev@dev",
"drupal/menu_trail_by_path": "^2.0",
"drupal/metatag": "^1.16",
"drupal/migrate_plus": "^6.0",
"drupal/modifiers": "^1.2",
"drupal/modifiers_pack": "^2.0",
"drupal/module_filter": "dev-3.x",
Expand Down Expand Up @@ -89,6 +90,7 @@
"drupal/core": {
"Plugin blocks cannot set their own attributes when put in the layout": "https://git.drupalcode.org/project/drupal/-/merge_requests/1426.patch",
"Order image mappings by breakpoint ID and numeric multiplier": "https://www.drupal.org/files/issues/2022-05-19/3267870-9.5.x-47.patch",
"Add menu_link_content support into views": "https://www.drupal.org/files/issues/2022-11-21/drupal-2777749-menu_link_content-views-support-23.patch",
"Add Width and Height attribute to Responsive images.": "https://www.drupal.org/files/issues/2022-09-30/3192234-228-9.5.x.patch"
},
"drupal/paragraphs": {
Expand Down
4 changes: 4 additions & 0 deletions config/install/search_api.index.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ field_settings:
anonymous: anonymous
view_mode:
'entity:node':
board: full
event: full
news: full
page: full
person: full
status:
label: Published
datasource_id: 'entity:node'
Expand Down
4 changes: 2 additions & 2 deletions csgov.install
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* @file
* Install, update and uninstall functions for the csgov installation profile.
* Install, update and uninstall functions for the CS Gov installation profile.
*/

use Drupal\user\Entity\User;
Expand All @@ -17,6 +17,6 @@ use Drupal\user\Entity\User;
function csgov_install() {
// Assign user 1 the "administrator" role.
$user = User::load(1);
$user->roles[] = 'administrator';
$user->addRole('administrator');
$user->save();
}
5 changes: 5 additions & 0 deletions csgov.links.menu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
csgov.admin_config_csgov:
title: 'CS Gov'
route_name: csgov.admin_config_csgov
parent: system.admin_config
weight: -50
44 changes: 43 additions & 1 deletion csgov.profile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,58 @@

/**
* @file
* Enables modules and site configuration for a csgov site installation.
* Enables modules and site configuration for a CS Gov site installation.
*/

use Drupal\Core\Form\FormStateInterface;

/**
* Implements hook_install_tasks().
*/
function csgov_install_tasks(&$install_state) {
$tasks = [
'csgov_install_settings_form' => [
'display_name' => t('CS Gov settings'),
'type' => 'form',
'function' => 'Drupal\csgov\Installer\Form\SettingsForm',
],
];

if (!empty($install_state['parameters']['csgov_migrate'])) {
$tasks['csgov_install_migrate_batch'] = [
'display_name' => '- ' . t('Default content'),
'type' => 'batch',
];
}

return $tasks;
}

/**
* Implements hook_form_FORM_ID_alter() for install_configure_form().
*
* Allows the profile to alter the site configuration form.
*/
function csgov_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
$form['site_information']['site_name']['#default_value'] = 'CS Gov Starterkit';
$form['regional_settings']['site_default_country']['#default_value'] = 'CZ';
}

/**
* Imports default content via a batch process during installation.
*
* @param $install_state
* An array of information about the current installation state.
*
* @return array|null
* The batch definition.
*/
function csgov_install_migrate_batch(&$install_state) {
// Install dependencies of migrate scripts.
\Drupal::service('module_installer')->install(['csgov_migrate']);
// Set first migrated page as site front page.
\Drupal::configFactory()->getEditable('system.site')
->set('page.front', '/node/1')->save(TRUE);
// Process migrations.
return _csgov_migrate_get_batch('import');
}
7 changes: 7 additions & 0 deletions csgov.routing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
csgov.admin_config_csgov:
path: '/admin/config/csgov'
defaults:
_controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
_title: 'CS Gov'
requirements:
_permission: 'administer site configuration'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
langcode: cs
status: true
dependencies: { }
id: csgov_migrate
label: 'CS Gov Migrate'
description: ''
source_type: null
module: null
shared_configuration: null
Loading

0 comments on commit 4df11d4

Please sign in to comment.