-
Notifications
You must be signed in to change notification settings - Fork 0
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
20 changed files
with
539 additions
and
45 deletions.
There are no files selected for viewing
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
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,5 @@ | ||
entity.faker_profile.add_form: | ||
route_name: 'entity.faker_profile.add_form' | ||
title: 'Add Faker Profile' | ||
appears_on: | ||
- entity.faker_profile.collection |
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,5 @@ | ||
entity.faker_profile.collection: | ||
title: 'Faker Profiles' | ||
parent: system.admin_config_development | ||
description: 'Configure Faker Profiles' | ||
route_name: entity.faker_profile.collection |
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
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,3 @@ | ||
administer faker profile configuration: | ||
title: 'Manage Faker Profiles' | ||
restrict access: TRUE |
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,31 @@ | ||
entity.faker_profile.collection: | ||
path: '/admin/config/development/faker-profile' | ||
defaults: | ||
_entity_list: 'faker_profile' | ||
_title: 'Faker Profile configuration' | ||
requirements: | ||
_permission: 'administer faker profile configuration' | ||
|
||
entity.faker_profile.add_form: | ||
path: '/admin/config/development/faker-profile/add' | ||
defaults: | ||
_entity_form: 'faker_profile.add' | ||
_title: 'Add Faker Profile' | ||
requirements: | ||
_permission: 'administer faker profile configuration' | ||
|
||
entity.faker_profile.edit_form: | ||
path: '/admin/config/development/faker-profile/{faker_profile}' | ||
defaults: | ||
_entity_form: 'faker_profile.edit' | ||
_title: 'Edit Faker Profile' | ||
requirements: | ||
_permission: 'administer faker profile configuration' | ||
|
||
entity.faker_profile.delete_form: | ||
path: '/admin/config/development/faker-profile/{faker_profile}/delete' | ||
defaults: | ||
_entity_form: 'faker_profile.delete' | ||
_title: 'Delete Faker Profile' | ||
requirements: | ||
_permission: 'administer faker profile configuration' |
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
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,78 @@ | ||
<?php | ||
|
||
namespace Drupal\faker\Entity; | ||
|
||
use Drupal\Core\Config\Entity\ConfigEntityBase; | ||
use Drupal\faker\FakerProfileInterface; | ||
|
||
/** | ||
* Defines the Faker Profile entity. | ||
* | ||
* @ConfigEntityType( | ||
* id = "faker_profile", | ||
* label = @Translation("Faker Profile"), | ||
* handlers = { | ||
* "list_builder" = "Drupal\faker\FakerProfileListBuilder", | ||
* "form" = { | ||
* "add" = "Drupal\faker\Form\FakerProfileForm", | ||
* "edit" = "Drupal\faker\Form\FakerProfileForm", | ||
* "delete" = "Drupal\Core\Entity\EntityDeleteForm", | ||
* } | ||
* }, | ||
* config_prefix = "faker_profile", | ||
* admin_permission = "administer faker profile configuration", | ||
* entity_keys = { | ||
* "id" = "id", | ||
* "label" = "label", | ||
* "data_samplers" = "data_samplers", | ||
* }, | ||
* config_export = { | ||
* "id", | ||
* "label", | ||
* "data_samplers", | ||
* }, | ||
* links = { | ||
* "edit-form" = "/admin/config/development/faker-profile/{faker_profile}", | ||
* "delete-form" = "/admin/config/development/faker-profile/{faker_profile}/delete", | ||
* } | ||
* ) | ||
*/ | ||
class FakerProfile extends ConfigEntityBase implements FakerProfileInterface { | ||
|
||
/** | ||
* The Faker Profile ID. | ||
* | ||
* @var string | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* The Faker Profile label. | ||
* | ||
* @var string | ||
*/ | ||
public $label; | ||
|
||
/** | ||
* The Faker Profile data samplers. | ||
* | ||
* @var mixed | ||
*/ | ||
public $data_samplers; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getDataSamplers() { | ||
return $this->data_samplers; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setDataSamplers(array $data_samplers) { | ||
$this->data_samplers = $data_samplers; | ||
return $this; | ||
} | ||
|
||
} |
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
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
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
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
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,30 @@ | ||
<?php | ||
|
||
namespace Drupal\faker; | ||
|
||
use Drupal\Core\Config\Entity\ConfigEntityInterface; | ||
|
||
/** | ||
* Provides an interface defining the Faker Profile entity. | ||
*/ | ||
interface FakerProfileInterface extends ConfigEntityInterface { | ||
|
||
/** | ||
* Get the Data Samplers. | ||
* | ||
* @return array | ||
* An array of data sampler id keys. | ||
*/ | ||
public function getDataSamplers(); | ||
|
||
/** | ||
* Set the Data Samplers. | ||
* | ||
* @param array $data_samplers | ||
* An array of data sampler id keys. | ||
* | ||
* @return $this | ||
*/ | ||
public function setDataSamplers(array $data_samplers); | ||
|
||
} |
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,33 @@ | ||
<?php | ||
|
||
namespace Drupal\faker; | ||
|
||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder; | ||
use Drupal\Core\Entity\EntityInterface; | ||
|
||
/** | ||
* Class FakerProfileListBuilder. | ||
* | ||
* @package Drupal\faker | ||
*/ | ||
class FakerProfileListBuilder extends ConfigEntityListBuilder { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildHeader() { | ||
$header['label'] = $this->t('Faker Profile'); | ||
$header['id'] = $this->t('Machine name'); | ||
return $header + parent::buildHeader(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildRow(EntityInterface $entity) { | ||
$row['label'] = $entity->label(); | ||
$row['id'] = $entity->id(); | ||
return $row + parent::buildRow($entity); | ||
} | ||
|
||
} |
Oops, something went wrong.