/** * {@inheritdoc} */ public function __construct(array $settings, $plugin_id, array $plugin_definition) { parent::__construct($settings, $plugin_id, $plugin_definition); // Calculate the upload directory. // $this->availableEntities = \Drupal::service('plugin.manager.entity_reference.selection') // ->getInstance(array('field_definition' => $this->settings['instance'])) // ->getReferenceableEntities(); $this->entityQuery = \Drupal::entityQuery($this->getEntityType()); }
/** * {@inheritdoc} */ public function __construct(array $settings, $plugin_id, array $plugin_definition) { parent::__construct($settings, $plugin_id, $plugin_definition); // Calculate the upload directory. if (isset($this->settings['instance'])) { $this->uploadDirectory = $this->settings['instance']->getFieldSetting('uri_scheme'); $this->uploadDirectory .= '://' . $this->settings['instance']->getFieldSetting('file_directory'); } }
/** * {@inheritdoc} */ public function __construct(array $settings, $plugin_id, array $plugin_definition) { parent::__construct($settings, $plugin_id, $plugin_definition); $datetime_type = $this->settings['settings']['datetime_type']; $this->storageFormat = $datetime_type == 'date' ? DATETIME_DATE_STORAGE_FORMAT : DATETIME_DATETIME_STORAGE_FORMAT; }
/** * Constructs an EntityReference object. * * @param array $configuration * The plugin configuration. * @param string $plugin_id * The plugin id. * @param array $plugin_definition * The plugin definition. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory * The entity query factory. */ public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityManagerInterface $entity_manager, QueryFactory $query_factory) { $this->entityManager = $entity_manager; $this->queryFactory = $query_factory; parent::__construct($configuration, $plugin_id, $plugin_definition); }