Newer
Older
Angie Byron
committed
<?php
/**
* @file
* Definition of Drupal\config_test\Entity\ConfigTest.
Angie Byron
committed
*/
namespace Drupal\config_test\Entity;
Angie Byron
committed
use Drupal\Core\Config\Entity\ConfigEntityBase;
Alex Pott
committed
use Drupal\config_test\ConfigTestInterface;
Angie Byron
committed
/**
* Defines the ConfigTest configuration entity.
*
Alex Pott
committed
* @ConfigEntityType(
Angie Byron
committed
* id = "config_test",
* label = @Translation("Test configuration"),
* controllers = {
* "storage" = "Drupal\config_test\ConfigTestStorageController",
* "list" = "Drupal\config_test\ConfigTestListController",
* "default" = "Drupal\config_test\ConfigTestFormController",
* "delete" = "Drupal\config_test\Form\ConfigTestDeleteForm"
* },
* "access" = "Drupal\config_test\ConfigTestAccessController"
Angie Byron
committed
* },
* config_prefix = "dynamic",
Angie Byron
committed
* entity_keys = {
* "id" = "id",
* "label" = "label",
* "status" = "status"
Alex Pott
committed
* },
* links = {
Alex Pott
committed
* "edit-form" = "config_test.entity",
* "delete-form" = "config_test.entity_delete",
* "enable" = "config_test.entity_enable",
* "disable" = "config_test.entity_disable"
Angie Byron
committed
* }
* )
*/
Alex Pott
committed
class ConfigTest extends ConfigEntityBase implements ConfigTestInterface {
Angie Byron
committed
/**
* The machine name for the configuration entity.
*
* @var string
*/
public $id;
/**
* The human-readable name of the configuration entity.
*
* @var string
*/
public $label;
Alex Pott
committed
/**
* The weight of the configuration entity.
*
* @var int
*/
public $weight = 0;
Angie Byron
committed
/**
* The image style to use.
*
* @var string
*/
public $style;
Angie Byron
committed
/**
* A protected property of the configuration entity.
*
* @var string
*/
protected $protected_property;
/**
* Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties();
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
$protected_names = array(
'protected_property',
);
foreach ($protected_names as $name) {
$properties[$name] = $this->get($name);
}
return $properties;
}
/**
* Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::sort().
*/
public static function sort($a, $b) {
\Drupal::state()->set('config_entity_sort', TRUE);
return parent::sort($a, $b);
}