reverted: --- b/core/profiles/demo_umami/interdiff--2809635-157-169.txt +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php -index 00cc6c1c50..f136c6941c 100644 ---- a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php -+++ b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php -@@ -157,6 +157,7 @@ public function importRecipes() { - // Set article author. - if (!empty($data['author'])) { - $values['uid'] = $this->getUser($data['author']); -+ $values['field_author'] = $values['uid']; - } - // Set node alias if exists. - if (!empty($data['slug'])) { -@@ -348,6 +349,7 @@ protected function getUser($name) { - // Creating user without any email/password. - $user = $user_storage->create([ - 'name' => $name, -+ 'status' => 1, - ]); - $user->enforceIsNew(); - $user->save(); -diff --git a/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php b/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php -index 1ef139eaf0..2bc976d80c 100644 ---- a/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php -+++ b/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php -@@ -91,4 +91,21 @@ protected function assertDefaultConfig(StorageInterface $default_config_storage, - } - } - -+ /** -+ * Tests the successful editing of nodes by admin. -+ */ -+ public function testEditNodesByAdmin() { -+ $account = $this->drupalCreateUser(['administer nodes', 'edit any recipe content']); -+ $this->drupalLogin($account); -+ $webassert = $this->assertSession(); -+ -+ // Check that admin is able to edit the node. -+ $nodes = entity_load_multiple_by_properties('node', ['title' => 'Deep mediterranean quiche']); -+ $node = reset($nodes); -+ $this->drupalGet('node/' . $node->id() . '/edit'); -+ $webassert->statusCodeEquals('200'); -+ $this->submitForm([], "Save"); -+ $webassert->pageTextContains('Recipe Deep mediterranean quiche has been updated.'); -+ } -+ - } diff -u b/core/profiles/demo_umami/modules/demo_umami_content/demo_umami_content.install b/core/profiles/demo_umami/modules/demo_umami_content/demo_umami_content.install --- b/core/profiles/demo_umami/modules/demo_umami_content/demo_umami_content.install +++ b/core/profiles/demo_umami/modules/demo_umami_content/demo_umami_content.install @@ -12,12 +12,7 @@ */ function demo_umami_content_install() { if (!\Drupal::service('config.installer')->isSyncing()) { - \Drupal::classResolver() - ->getInstanceFromDefinition(InstallHelper::class) - ->importArticles() - ->importRecipes() - ->importPages() - ->importBlockContent(); + \Drupal::classResolver()->getInstanceFromDefinition(InstallHelper::class)->importContent(); } } diff -u b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php --- b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php @@ -78,11 +78,21 @@ } /** + * Imports default contents. + */ + public function importContent() { + $this->importArticles() + ->importRecipes() + ->importPages() + ->importBlockContent(); + } + + /** * Imports articles. * * @return $this */ - public function importArticles() { + protected function importArticles() { $module_path = $this->moduleHandler->getModule('demo_umami_content') ->getPath(); if (($handle = fopen($module_path . '/default_content/articles.csv', "r")) !== FALSE) { @@ -141,7 +151,7 @@ * * @return $this */ - public function importRecipes() { + protected function importRecipes() { $module_path = $this->moduleHandler->getModule('demo_umami_content')->getPath(); if (($handle = fopen($module_path . '/default_content/recipes.csv', "r")) !== FALSE) { @@ -151,7 +161,7 @@ $data = array_combine($header, $data); $values = [ 'type' => 'recipe', - // Title field. + // Title field. 'title' => $data['title'], ]; // Set article author. @@ -235,7 +245,7 @@ * * @return $this */ - public function importPages() { + protected function importPages() { if (($handle = fopen($this->moduleHandler->getModule('demo_umami_content')->getPath() . '/default_content/pages.csv', "r")) !== FALSE) { $headers = fgetcsv($handle); $uuids = []; @@ -277,7 +287,7 @@ * * @return $this */ - public function importBlockContent() { + protected function importBlockContent() { $module_path = $this->moduleHandler->getModule('demo_umami_content')->getPath(); $block_content_entities = [ 'umami_recipes_banner' => [ @@ -294,7 +304,7 @@ return $this->aliasManager->getAliasByPath('/node/' . $node->id()); }), 'title' => 'Super easy vegetarian pasta bake', - ], + ], 'field_summary' => [ 'value' => 'A wholesome pasta bake is the ultimate comfort food. This delicious bake is super quick to prepare and an ideal midweek meal for all the family.', ],