ticket-8.x-1.x-dev/src/Plugin/DataType/RegistrationTypeConfig.php

src/Plugin/DataType/RegistrationTypeConfig.php
<?php

namespace Drupal\ticket\Plugin\DataType;

use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\TypedData\TypedData;

/**
 * Provides a data type wrapping for Registration Type Config.
 *
 * @DataType(
 *   id = "registration_type_config",
 *   label = @Translation("Registration Type Config"),
 *   description = @Translation("A registration type config."),
 * )
 *
 * @internal
 *   Plugin classes are internal.
 */
class RegistrationTypeConfig extends TypedData {

  /**
   * The Registration Type Config object.
   *
   * @var \Drupal\Core\Config\Entity\ConfigEntityInterface
   */
  protected $value;

  /**
   * {@inheritdoc}
   */
  public function setValue($value, $notify = TRUE) {
    if ($value && !$value instanceof ConfigEntityInterface) {
      throw new \InvalidArgumentException(sprintf('Value assigned to "%s" is not a valid config', $this->getName()));
    }
    parent::setValue($value, $notify);
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc