-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...ject/modules/hoeringsportal_project_fixtures/hoeringsportal_project_fixtures.services.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
services: | ||
Drupal\hoeringsportal_project_fixtures\Fixture\BlockContentFixture: | ||
tags: | ||
- { name: content_fixture } | ||
|
||
Drupal\hoeringsportal_project_fixtures\Fixture\ProjectMainPageFixture: | ||
tags: | ||
- { name: content_fixture } |
60 changes: 60 additions & 0 deletions
60
...ortal_project/modules/hoeringsportal_project_fixtures/src/Fixture/BlockContentFixture.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace Drupal\hoeringsportal_project_fixtures\Fixture; | ||
|
||
use Drupal\block_content\Entity\BlockContent; | ||
use Drupal\content_fixtures\Fixture\AbstractFixture; | ||
use Drupal\content_fixtures\Fixture\FixtureGroupInterface; | ||
|
||
/** | ||
* Block content fixture. | ||
* | ||
* @package Drupal\hoeringsportal_project_fixtures\Fixture | ||
*/ | ||
class BlockContentFixture extends AbstractFixture implements FixtureGroupInterface { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load() { | ||
$entity = BlockContent | ||
::create([ | ||
'type' => 'aside_contact_info', | ||
]) | ||
->setInfo('The main address') | ||
->set('field_department', 'Redundancy Department') | ||
->set('field_title', 'Department of Redundancy Department') | ||
->set('body', [ | ||
'value' => '<p>Department<br>Street No.<br>1234</p>', | ||
]) | ||
->set('field_phone_number', 1234567890) | ||
->set('field_email', '[email protected]'); | ||
|
||
$entity->save(); | ||
$this->addReference('block_content:the_main_address', $entity); | ||
|
||
$entity = BlockContent | ||
::create([ | ||
'type' => 'aside_contact_info', | ||
]) | ||
->setInfo('Another address') | ||
->set('field_department', 'The Department') | ||
->set('field_title', 'Title of the Department') | ||
->set('body', [ | ||
'value' => '<p>Street 87</p>', | ||
]) | ||
->set('field_phone_number', 2234455) | ||
->set('field_email', '[email protected]'); | ||
|
||
$entity->save(); | ||
$this->addReference('block_content:another_address', $entity); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getGroups() { | ||
return ['block', 'project']; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters