コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function __construct($name, $config = array(), $structure = NULL, $parent = NULL)
 {
     parent::__construct($name, $config, $structure, $parent);
     // Ensure the field instance exists.
     if (empty($config['field_instance']) || !$config['field_instance'] instanceof FieldInterface) {
         throw new \InvalidArgumentException();
     }
     $this->field = $config['field_instance'];
     // Allow for a constructor.
     if (!empty($config['field_constructor']) && is_callable($config['field_constructor'])) {
         $this->constructor = $config['field_constructor'];
     }
     // Now get the sanitized config.
     $this->config = (new ArrayValue($this->field->getValue(), $this->constructor))->setConfig($config)->getConfig();
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function __construct($name, $config = array(), $structure = NULL, $parent = NULL)
 {
     parent::__construct($name, $config, $structure, $parent);
     $this->config = (new IntegerValue())->setConfig($config)->getConfig();
 }