/** * {@inheritdoc} */ public static function createFromDataType($type) { $definition = parent::createFromDataType($type); // If nothing else given, default to a list of 'any' items. $definition->itemDefinition = DataDefinition::create('any'); return $definition; }
public function index() { $this->view->set('clickaction', 'view'); $collection = new EDITransactionLogCollection($this->_templateobject); $sh = $this->setSearchHandler($collection); if (isset($this->_data['data_definition_id'])) { $sh->addConstraint(new COnstraint('data_definition_id', '=', $this->_data['data_definition_id'])); $datadef = new DataDefinition(); $datadef->load($this->_data['data_definition_id']); $this->view->set('datadef', $datadef); } parent::index(new EDITransactionLogCollection($this->_templateobject), $sh); $sidebar = new SidebarController($this->view); $sidebar->addList('Actions', array('new' => array('link' => array('modules' => $this->_modules, 'controller' => 'externalsystems', 'action' => 'index'), 'tag' => 'view external systems'))); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
/** * {@inheritdoc} */ public function getConstraints() { $constraints = parent::getConstraints(); // If this data definition is marked as required for the sake of schema // definitions, we don't enforce it using the NotNull constraint. Instead // \Drupal\Core\Field\EntityReferenceItem is validated by the // 'ValidReference' constraint that operates at the field-item level. This // constraint takes into consideration that the target_id property can // be derived from the entity property. unset($constraints['NotNull']); return $constraints; }
/** * Creates a new data reference definition. * * @param string $target_data_type * The data type of the referenced data. * * @return static */ public static function create($target_data_type) { // This assumes implementations use a "TYPE_reference" naming pattern. $definition = parent::create($target_data_type . '_reference'); return $definition->setTargetDefinition(\Drupal::typedDataManager()->createDataDefinition($target_data_type)); }