/** * {@inheritdoc} */ public function form(array $form, FormStateInterface $form_state) { $form = parent::form($form, $form_state); $type = $this->entity; if ($this->operation == 'add') { $form['#title'] = $this->t('Add log type'); $fields = $this->entityManager->getBaseFieldDefinitions('log'); // Create a node with a fake bundle using the type's UUID so that we can // get the default values for workflow settings. // @todo Make it possible to get default values without an entity. // https://www.drupal.org/node/2318187 $node = $this->entityManager->getStorage('log')->create(array('type' => $type->uuid())); } else { $form['#title'] = $this->t('Edit %label log type', array('%label' => $type->label())); $fields = $this->entityManager->getFieldDefinitions('log', $type->id()); // Create a node to get the current values for workflow settings fields. $node = $this->entityManager->getStorage('log')->create(array('type' => $type->id())); } $form['name'] = array('#title' => t('Name'), '#type' => 'textfield', '#default_value' => $type->label(), '#description' => t('The human-readable name of this log type. This text will be displayed as part of the list on the <em>Add content</em> page. This name must be unique.'), '#required' => TRUE, '#size' => 30); $form['type'] = array('#type' => 'machine_name', '#default_value' => $type->id(), '#maxlength' => EntityTypeInterface::BUNDLE_MAX_LENGTH, '#machine_name' => array('exists' => ['Drupal\\node\\Entity\\LogType', 'load'], 'source' => array('name')), '#description' => t('A unique machine-readable name for this content type. It must only contain lowercase letters, numbers, and underscores. This name will be used for constructing the URL of the %log-add page, in which underscores will be converted into hyphens.', array('%log-add' => t('Add content')))); $form['description'] = array('#title' => t('Description'), '#type' => 'textarea', '#default_value' => $type->getDescription(), '#description' => t('This text will be displayed on the <em>Add new content</em> page.')); $form['additional_settings'] = array('#type' => 'vertical_tabs', '#attached' => array('library' => array('node/drupal.content_types'))); $form['submission'] = array('#type' => 'details', '#title' => t('Submission form settings'), '#group' => 'additional_settings', '#open' => TRUE); $form['submission']['preview_mode'] = array('#type' => 'radios', '#title' => t('Preview before submitting'), '#default_value' => $type->getPreviewMode(), '#options' => array(DRUPAL_DISABLED => t('Disabled'), DRUPAL_OPTIONAL => t('Optional'), DRUPAL_REQUIRED => t('Required'))); $form['submission']['help'] = array('#type' => 'textarea', '#title' => t('Explanation or submission guidelines'), '#default_value' => $type->getHelp(), '#description' => t('This text will be displayed at the top of the page when creating or editing content of this type.')); $form['workflow'] = array('#type' => 'details', '#title' => t('Publishing options'), '#group' => 'additional_settings'); $workflow_options = array('status' => $node->status->value, 'promote' => $node->promote->value, 'sticky' => $node->sticky->value, 'revision' => $type->isNewRevision()); // Prepare workflow options to be used for 'checkboxes' form element. $keys = array_keys(array_filter($workflow_options)); $workflow_options = array_combine($keys, $keys); $form['workflow']['options'] = array('#type' => 'checkboxes', '#title' => t('Default options'), '#default_value' => $workflow_options, '#options' => array('status' => t('Published'), 'promote' => t('Promoted to front page'), 'sticky' => t('Sticky at top of lists'), 'revision' => t('Create new revision')), '#description' => t('Users with the <em>Administer content</em> permission will be able to override these options.')); $form['display'] = array('#type' => 'details', '#title' => t('Display settings'), '#group' => 'additional_settings'); $form['display']['display_submitted'] = array('#type' => 'checkbox', '#title' => t('Display author and date information'), '#default_value' => $type->displaySubmitted(), '#description' => t('Author username and publish date will be displayed.')); return $this->protectBundleIdElement($form); }
protected function getPotentialFields() { $field_definitions = $this->entityManager->getBaseFieldDefinitions($this->getEntityType()); $field_definitions = array_filter($field_definitions, [$this, 'filterFieldTypes']); $options = []; foreach ($field_definitions as $id => $definition) { $options[$id] = SafeMarkup::checkPlain($definition->getLabel()); } return $options; }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $config = $this->config('diff.settings'); $values = $form_state->getValues(); $support_ticket_base_fields = $this->entityManager->getBaseFieldDefinitions('support_ticket'); foreach ($support_ticket_base_fields as $field_key => $field) { $config->set('entity.support_ticket' . '.' . $field_key, $values[$field_key]); $config->save(); } return parent::submitForm($form, $form_state); }
/** * {@inheritdoc} */ public function tableFields($bundles) { $info = $this->entityManager->getDefinition($this->entityTypeId()); $definitions = $this->entityManager->getBaseFieldDefinitions($this->entityTypeId()); $label_key = $info->getKey('label'); $label_field_label = t('Label'); if ($label_key && isset($definitions[$label_key])) { $label_field_label = $definitions[$label_key]->getLabel(); } $bundle_key = $info->getKey('bundle'); $bundle_field_label = t('Type'); if ($bundle_key && isset($definitions[$bundle_key])) { $bundle_field_label = $definitions[$bundle_key]->getLabel(); } $fields = []; $fields['label'] = [ 'type' => 'label', 'label' => $label_field_label, 'weight' => 1, ]; if (count($bundles) > 1) { $fields[$bundle_key] = [ 'type' => 'field', 'label' => $bundle_field_label, 'weight' => 2, ]; } return $fields; }
/** * Gets the field definition from a specific entity base field. * * The method takes the field ID as an argument and returns the field storage * definition to be used in getIds() by querying the destination entity base * field definition. * * @param string $key * The field ID key. * * @return array * An associative array with a structure that contains the field type, keyed * as 'type', together with field storage settings as they are returned by * FieldStorageDefinitionInterface::getSettings(). * * @see \Drupal\Core\Field\FieldStorageDefinitionInterface::getSettings() */ protected function getDefinitionFromEntity($key) { $entity_type_id = static::getEntityTypeId($this->getPluginId()); /** @var \Drupal\Core\Field\FieldStorageDefinitionInterface[] $definitions */ $definitions = $this->entityManager->getBaseFieldDefinitions($entity_type_id); $field_definition = $definitions[$key]; return ['type' => $field_definition->getType()] + $field_definition->getSettings(); }
/** * Transforms an entity into an array of strings. * * Parses an entity's fields and for every field it builds an array of string * to be compared. Basically this function transforms an entity into an array * of strings. * * @param ContentEntityInterface $entity * An entity containing fields. * * @return array * Array of strings resulted by parsing the entity. */ public function parseEntity(ContentEntityInterface $entity) { $result = array(); $langcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId(); // Load entity of current language, otherwise fields are always compared by // their default language. if ($entity->hasTranslation($langcode)) { $entity = $entity->getTranslation($langcode); } $entity_type_id = $entity->getEntityTypeId(); // Load all entity base fields. $entity_base_fields = $this->entityManager->getBaseFieldDefinitions($entity_type_id); // Loop through entity fields and transform every FieldItemList object // into an array of strings according to field type specific settings. foreach ($entity as $field_items) { $field_type = $field_items->getFieldDefinition()->getType(); $plugin_config = $this->pluginsConfig->get('field_types.' . $field_type); $plugin = NULL; if ($plugin_config && $plugin_config['type'] != 'hidden') { $plugin = $this->diffBuilderManager->createInstance($plugin_config['type'], $plugin_config['settings']); } if ($plugin) { // Configurable field. It is the responsibility of the class extending // this class to hide some configurable fields from comparison. This // class compares all configurable fields. if (!array_key_exists($field_items->getName(), $entity_base_fields)) { $build = $plugin->build($field_items); if (!empty($build)) { $result[$field_items->getName()] = $build; } } else { // Check if this field needs to be compared. $config_key = 'entity.' . $entity_type_id . '.' . $field_items->getName(); $enabled = $this->config->get($config_key); if ($enabled) { $build = $plugin->build($field_items); if (!empty($build)) { $result[$field_items->getName()] = $build; } } } } } return $result; }
/** * Test that translation destination fails for untranslatable entities. * * @expectedException \Drupal\migrate\MigrateException * @expectedExceptionMessage This entity type does not support translation */ public function testUntranslatable() { // An entity type without a language. $entity_type = $this->prophesize(ContentEntityType::class); $entity_type->getKey('langcode')->willReturn(''); $entity_type->getKey('id')->willReturn('id'); $this->entityManager->getBaseFieldDefinitions('foo')->willReturn(['id' => BaseFieldDefinitionTest::create('integer')]); $this->storage->getEntityType()->willReturn($entity_type->reveal()); $destination = new EntityTestDestination(['translations' => TRUE], '', [], $this->migration->reveal(), $this->storage->reveal(), [], $this->entityManager->reveal(), $this->prophesize(FieldTypePluginManagerInterface::class)->reveal()); $destination->getIds(); }
/** * Ensures integer entity IDs are valid. * * The identifier sanitization provided by this method has been introduced * as Drupal used to rely on the database to facilitate this, which worked * correctly with MySQL but led to errors with other DBMS such as PostgreSQL. * * @param array $ids * The entity IDs to verify. * * @return array * The sanitized list of entity IDs. */ protected function cleanIds(array $ids) { $definitions = $this->entityManager->getBaseFieldDefinitions($this->entityTypeId); $id_definition = $definitions[$this->entityType->getKey('id')]; if ($id_definition->getType() == 'integer') { $ids = array_filter($ids, function ($id) { return is_numeric($id) && $id == (int) $id; }); $ids = array_map('intval', $ids); } return $ids; }
/** * {@inheritdoc} */ public function denormalize($data, $class, $format = NULL, array $context = []) { // Get the entity type ID while letting context override the $class param. $entity_type_id = !empty($context['entity_type']) ? $context['entity_type'] : $this->entityManager->getEntityTypeFromClass($class); /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type_definition */ // Get the entity type definition. $entity_type_definition = $this->entityManager->getDefinition($entity_type_id, FALSE); // Don't try to create an entity without an entity type id. if (!$entity_type_definition) { throw new UnexpectedValueException(sprintf('The specified entity type "%s" does not exist. A valid etnity type is required for denormalization', $entity_type_id)); } // The bundle property will be required to denormalize a bundleable entity. if ($entity_type_definition->hasKey('bundle')) { $bundle_key = $entity_type_definition->getKey('bundle'); // Get the base field definitions for this entity type. $base_field_definitions = $this->entityManager->getBaseFieldDefinitions($entity_type_id); // Get the ID key from the base field definition for the bundle key or // default to 'value'. $key_id = isset($base_field_definitions[$bundle_key]) ? $base_field_definitions[$bundle_key]->getFieldStorageDefinition()->getMainPropertyName() : 'value'; // Normalize the bundle if it is not explicitly set. $data[$bundle_key] = isset($data[$bundle_key][0][$key_id]) ? $data[$bundle_key][0][$key_id] : (isset($data[$bundle_key]) ? $data[$bundle_key] : NULL); // Get the bundle entity type from the entity type definition. $bundle_type_id = $entity_type_definition->getBundleEntityType(); $bundle_types = $bundle_type_id ? $this->entityManager->getStorage($bundle_type_id)->getQuery()->execute() : []; // Make sure a bundle has been provided. if (!is_string($data[$bundle_key])) { throw new UnexpectedValueException('A string must be provided as a bundle value.'); } // Make sure the submitted bundle is a valid bundle for the entity type. if ($bundle_types && !in_array($data[$bundle_key], $bundle_types)) { throw new UnexpectedValueException(sprintf('"%s" is not a valid bundle type for denormalization.', $data[$bundle_key])); } } // Create the entity from data. $entity = $this->entityManager->getStorage($entity_type_id)->create($data); // Pass the names of the fields whose values can be merged. // @todo https://www.drupal.org/node/2456257 remove this. $entity->_restSubmittedFields = array_keys($data); return $entity; }
/** * {@inheritdoc} */ public function form(array $form, FormStateInterface $form_state) { $form = parent::form($form, $form_state); $type = $this->entity; if ($this->operation == 'add') { $form['#title'] = SafeMarkup::checkPlain($this->t('Add support ticket type')); $fields = $this->entityManager->getBaseFieldDefinitions('support_ticket'); // Create a support ticket with a fake bundle using the type's UUID so that we can // get the default values for workflow settings. $support_ticket = $this->entityManager->getStorage('support_ticket')->create(array('support_ticket_type' => $type->uuid())); } else { $form['#title'] = $this->t('Edit %label support ticket type', array('%label' => $type->label())); $fields = $this->entityManager->getFieldDefinitions('support_ticket', $type->id()); // Create a support_ticket to get the current values for workflow settings fields. $support_ticket = $this->entityManager->getStorage('support_ticket')->create(array('support_ticket_type' => $type->id())); } $form['name'] = array('#title' => t('Name'), '#type' => 'textfield', '#default_value' => $type->label(), '#description' => t('The human-readable name of this support ticket type. This text will be displayed as part of the list on the <em>Add support ticket</em> page. This name must be unique.'), '#required' => TRUE, '#size' => 30); $form['type'] = array('#type' => 'machine_name', '#default_value' => $type->id(), '#maxlength' => EntityTypeInterface::BUNDLE_MAX_LENGTH, '#disabled' => $type->isLocked(), '#machine_name' => array('exists' => ['Drupal\\support_ticket\\Entity\\SupportTicketType', 'load'], 'source' => array('name')), '#description' => t('A unique machine-readable name for this support ticket type. It must only contain lowercase letters, numbers, and underscores. This name will be used for constructing the URL of the %support-ticket-add page, in which underscores will be converted into hyphens.', array('%support-ticket-add' => t('Add support ticket')))); $form['description'] = array('#title' => t('Description'), '#type' => 'textarea', '#default_value' => $type->getDescription(), '#description' => t('Describe this support ticket type. The text will be displayed on the <em>Add support ticket</em> page.')); $form['additional_settings'] = array('#type' => 'vertical_tabs', '#attached' => array('library' => array('support_ticket/drupal.support_ticket_types'))); $form['submission'] = array('#type' => 'details', '#title' => t('Submission form settings'), '#group' => 'additional_settings', '#open' => TRUE); $form['submission']['title_label'] = array('#title' => t('Title field label'), '#type' => 'textfield', '#default_value' => $fields['title']->getLabel(), '#required' => TRUE); $form['submission']['preview_mode'] = array('#type' => 'radios', '#title' => t('Preview before submitting'), '#default_value' => $type->getPreviewMode(), '#options' => array(DRUPAL_DISABLED => t('Disabled'), DRUPAL_OPTIONAL => t('Optional'), DRUPAL_REQUIRED => t('Required'))); $form['submission']['help'] = array('#type' => 'textarea', '#title' => t('Explanation or submission guidelines'), '#default_value' => $type->getHelp(), '#description' => t('This text will be displayed at the top of the page when creating or editing support tickets of this type.')); $form['workflow'] = array('#type' => 'details', '#title' => t('Publishing options'), '#group' => 'additional_settings'); $workflow_options = array('status' => $support_ticket->status->value, 'locked' => $support_ticket->locked->value, 'revision' => $type->isNewRevision()); // Prepare workflow options to be used for 'checkboxes' form element. $keys = array_keys(array_filter($workflow_options)); $workflow_options = array_combine($keys, $keys); $form['workflow']['options'] = array('#type' => 'checkboxes', '#title' => t('Default options'), '#default_value' => $workflow_options, '#options' => array('status' => t('Published'), 'locked' => t('Locked'), 'revision' => t('Create new revision')), '#description' => t('Users with the <em>Administer support tickets</em> permission will be able to override these options.')); if ($this->moduleHandler->moduleExists('language')) { $form['language'] = array('#type' => 'details', '#title' => t('Language settings'), '#group' => 'additional_settings'); $language_configuration = ContentLanguageSettings::loadByEntityTypeBundle('support_ticket', $type->id()); $form['language']['language_configuration'] = array('#type' => 'language_configuration', '#entity_information' => array('entity_type' => 'support_ticket', 'bundle' => $type->id()), '#default_value' => $language_configuration); } $form['display'] = array('#type' => 'details', '#title' => t('Display settings'), '#group' => 'additional_settings'); $form['display']['display_submitted'] = array('#type' => 'checkbox', '#title' => t('Display author and date information'), '#default_value' => $type->displaySubmitted(), '#description' => t('Author username and publish date will be displayed.')); return $form; }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { // Only allow content entities and ignore configuration entities. if (!$entity_type instanceof ContentEntityTypeInterface) { continue; } $this->derivatives["entity:{$entity_type_id}"] = ['label' => $this->t('Create a new @entity_type', ['@entity_type' => $entity_type->getLowercaseLabel()]), 'category' => $entity_type->getLabel(), 'entity_type_id' => $entity_type_id, 'context' => [], 'provides' => ['entity' => new ContextDefinition("entity:{$entity_type_id}", $entity_type->getLabel())]] + $base_plugin_definition; // Add a required context for the bundle key, and optional contexts for // other required base fields. This matches the storage create() behavior, // where only the bundle requirement is enforced. $bundle_key = $entity_type->getKey('bundle'); $base_field_definitions = $this->entityManager->getBaseFieldDefinitions($entity_type_id); foreach ($base_field_definitions as $field_name => $definition) { if ($field_name != $bundle_key && !$definition->isRequired()) { continue; } $required = $field_name == $bundle_key; $multiple = $definition->getCardinality() === 1 ? FALSE : TRUE; $this->derivatives["entity:{$entity_type_id}"]['context'][$field_name] = new ContextDefinition($definition->getType(), $definition->getLabel(), $required, $multiple, $definition->getDescription()); } } return $this->derivatives; }
/** * Gets the base field definitions for a content entity type. * * @return \Drupal\Core\Field\FieldDefinitionInterface[] * The array of base field definitions for the entity type, keyed by field * name. */ public function getFieldStorageDefinitions() { return $this->entityManager->getBaseFieldDefinitions($this->entityTypeId); }
/** * {@inheritdoc} */ public function getViewsData() { $data = []; $base_table = $this->entityType->getBaseTable() ?: $this->entityType->id(); $views_revision_base_table = NULL; $revisionable = $this->entityType->isRevisionable(); $base_field = $this->entityType->getKey('id'); $revision_table = ''; if ($revisionable) { $revision_table = $this->entityType->getRevisionTable() ?: $this->entityType->id() . '_revision'; } $translatable = $this->entityType->isTranslatable(); $data_table = ''; if ($translatable) { $data_table = $this->entityType->getDataTable() ?: $this->entityType->id() . '_field_data'; } // Some entity types do not have a revision data table defined, but still // have a revision table name set in // \Drupal\Core\Entity\Sql\SqlContentEntityStorage::initTableLayout() so we // apply the same kind of logic. $revision_data_table = ''; if ($revisionable && $translatable) { $revision_data_table = $this->entityType->getRevisionDataTable() ?: $this->entityType->id() . '_field_revision'; } $revision_field = $this->entityType->getKey('revision'); // Setup base information of the views data. $data[$base_table]['table']['group'] = $this->entityType->getLabel(); $data[$base_table]['table']['provider'] = $this->entityType->getProvider(); $views_base_table = $base_table; if ($data_table) { $views_base_table = $data_table; } $data[$views_base_table]['table']['base'] = ['field' => $base_field, 'title' => $this->entityType->getLabel(), 'cache_contexts' => $this->entityType->getListCacheContexts()]; $data[$base_table]['table']['entity revision'] = FALSE; if ($label_key = $this->entityType->getKey('label')) { if ($data_table) { $data[$views_base_table]['table']['base']['defaults'] = array('field' => $label_key, 'table' => $data_table); } else { $data[$views_base_table]['table']['base']['defaults'] = array('field' => $label_key); } } // Entity types must implement a list_builder in order to use Views' // entity operations field. if ($this->entityType->hasListBuilderClass()) { $data[$base_table]['operations'] = array('field' => array('title' => $this->t('Operations links'), 'help' => $this->t('Provides links to perform entity operations.'), 'id' => 'entity_operations')); } if ($this->entityType->hasViewBuilderClass()) { $data[$base_table]['rendered_entity'] = ['field' => ['title' => $this->t('Rendered entity'), 'help' => $this->t('Renders an entity in a view mode.'), 'id' => 'rendered_entity']]; } // Setup relations to the revisions/property data. if ($data_table) { $data[$base_table]['table']['join'][$data_table] = ['left_field' => $base_field, 'field' => $base_field, 'type' => 'INNER']; $data[$data_table]['table']['group'] = $this->entityType->getLabel(); $data[$data_table]['table']['provider'] = $this->entityType->getProvider(); $data[$data_table]['table']['entity revision'] = FALSE; } if ($revision_table) { $data[$revision_table]['table']['group'] = $this->t('@entity_type revision', ['@entity_type' => $this->entityType->getLabel()]); $data[$revision_table]['table']['provider'] = $this->entityType->getProvider(); $views_revision_base_table = $revision_table; if ($revision_data_table) { $views_revision_base_table = $revision_data_table; } $data[$views_revision_base_table]['table']['entity revision'] = TRUE; $data[$views_revision_base_table]['table']['base'] = array('field' => $revision_field, 'title' => $this->t('@entity_type revisions', array('@entity_type' => $this->entityType->getLabel()))); // Join the revision table to the base table. $data[$views_revision_base_table]['table']['join'][$views_base_table] = array('left_field' => $revision_field, 'field' => $revision_field, 'type' => 'INNER'); if ($revision_data_table) { $data[$revision_data_table]['table']['group'] = $this->t('@entity_type revision', ['@entity_type' => $this->entityType->getLabel()]); $data[$revision_data_table]['table']['entity revision'] = TRUE; $data[$revision_table]['table']['join'][$revision_data_table] = array('left_field' => $revision_field, 'field' => $revision_field, 'type' => 'INNER'); } } $this->addEntityLinks($data[$base_table]); // Load all typed data definitions of all fields. This should cover each of // the entity base, revision, data tables. $field_definitions = $this->entityManager->getBaseFieldDefinitions($this->entityType->id()); /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */ if ($table_mapping = $this->storage->getTableMapping($field_definitions)) { // Fetch all fields that can appear in both the base table and the data // table. $entity_keys = $this->entityType->getKeys(); $duplicate_fields = array_intersect_key($entity_keys, array_flip(['id', 'revision', 'bundle'])); // Iterate over each table we have so far and collect field data for each. // Based on whether the field is in the field_definitions provided by the // entity manager. // @todo We should better just rely on information coming from the entity // storage. // @todo https://www.drupal.org/node/2337511 foreach ($table_mapping->getTableNames() as $table) { foreach ($table_mapping->getFieldNames($table) as $field_name) { // To avoid confusing duplication in the user interface, for fields // that are on both base and data tables, only add them on the data // table (same for revision vs. revision data). if ($data_table && ($table === $base_table || $table === $revision_table) && in_array($field_name, $duplicate_fields)) { continue; } $this->mapFieldDefinition($table, $field_name, $field_definitions[$field_name], $table_mapping, $data[$table]); } } foreach ($field_definitions as $field_definition) { if ($table_mapping->requiresDedicatedTableStorage($field_definition->getFieldStorageDefinition())) { $table = $table_mapping->getDedicatedDataTableName($field_definition->getFieldStorageDefinition()); $data[$table]['table']['group'] = $this->entityType->getLabel(); $data[$table]['table']['provider'] = $this->entityType->getProvider(); $data[$table]['table']['join'][$views_base_table] = ['left_field' => $base_field, 'field' => 'entity_id', 'extra' => [['field' => 'deleted', 'value' => 0, 'numeric' => TRUE]]]; if ($revisionable) { $revision_table = $table_mapping->getDedicatedRevisionTableName($field_definition->getFieldStorageDefinition()); $data[$revision_table]['table']['group'] = $this->t('@entity_type revision', ['@entity_type' => $this->entityType->getLabel()]); $data[$revision_table]['table']['provider'] = $this->entityType->getProvider(); $data[$revision_table]['table']['join'][$views_revision_base_table] = ['left_field' => $revision_field, 'field' => 'entity_id', 'extra' => [['field' => 'deleted', 'value' => 0, 'numeric' => TRUE]]]; } } } } // Add the entity type key to each table generated. $entity_type_id = $this->entityType->id(); array_walk($data, function (&$table_data) use($entity_type_id) { $table_data['table']['entity type'] = $entity_type_id; }); return $data; }
/** * {@inheritdoc} */ public function getBaseFieldDefinitions($entity_type_id) { return $this->entityManager->getBaseFieldDefinitions($entity_type_id); }