123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- /**
- * @file
- * Definition of Drupal\wing\Plugin\Core\Entity\State.
- */
- namespace Drupal\wing\Plugin\Core\Entity;
- use Drupal\Core\Entity\EntityInterface;
- use Drupal\Core\Entity\EntityNG;
- use Drupal\Component\Annotation\Plugin;
- use Drupal\Core\Annotation\Translation;
- /**
- * Defines the Wing State entity class.
- *
- * @Plugin(
- * id = "wing_state",
- * label = @Translation("Wing: State"),
- * bundle_label = @Translation("Workflow"),
- * module = "wing",
- * controller_class = "Drupal\wing\WingStorageController",
- * render_controller_class = "Drupal\wing\WingRenderController",
- * form_controller_class = {
- * "default" = "Drupal\wing\WingFormController"
- * },
- * translation_controller_class = "Drupal\wing\WingTranslationController",
- * base_table = "wing_state",
- * uri_callback = "wing_uri",
- * fieldable = FALSE,
- * static_cache = TRUE,
- * entity_keys = {
- * "id" = "id",
- * "bundle" = "workflow",
- * "label" = "title",
- * "uuid" = "uuid"
- * }
- * )
- */
- class State extends EntityNG implements EntityInterface { // Or ContentEntityInterface ?
- /**
- * The State ID.
- *
- * @var \Drupal\Core\Entity\Field\FieldInterface
- */
- public $id;
- /**
- * The State UUID.
- *
- * @var \Drupal\Core\Entity\Field\FieldInterface
- */
- public $uuid;
- /**
- * The State language code.
- *
- * @var \Drupal\Core\Entity\Field\FieldInterface
- */
- public $langcode;
- /**
- * The State title.
- *
- * @var \Drupal\Core\Entity\Field\FieldInterface
- */
- public $title;
- /**
- * The time that the State was created.
- *
- * @var \Drupal\Core\Entity\Field\FieldInterface
- */
- public $created;
- /**
- * The time that the State was last edited.
- *
- * @var \Drupal\Core\Entity\Field\FieldInterface
- */
- public $changed;
- /**
- * The workflow to which the State belongs.
- *
- * @var \Drupal\Core\Entity\Field\FieldInterface
- */
- public $workflow;
- /**
- * The plain data values of the contained properties.
- *
- * Define default values.
- *
- * @var array
- */
- protected $values = array(
- 'langcode' => array(LANGUAGE_DEFAULT => array(0 => array('value' => LANGUAGE_NOT_SPECIFIED))),
- );
- /**
- * Initialize the object. Invoked upon construction and wake up.
- */
- protected function init() {
- parent::init();
- // We unset all defined properties, so magic getters apply.
- $rc = new \ReflectionClass($this);
- $properties = $rc->getProperties(\ReflectionProperty::IS_PUBLIC);
- foreach ($properties as $property) {
- unset($this->{$property->name});
- }
- }
- /**
- * Implements Drupal\Core\Entity\EntityInterface::id().
- */
- public function id() {
- return $this->get('id')->value;
- }
- }
|