public function EntityManager::processDefinition

Overrides Drupal\Component\Plugin\PluginManagerBase::processDefinition().

Overrides PluginManagerBase::processDefinition

File

drupal/core/lib/Drupal/Core/Entity/EntityManager.php, line 274
Contains \Drupal\Core\Entity\EntityManager.

Class

EntityManager
Manages entity type plugin definitions.

Namespace

Drupal\Core\Entity

Code

public function processDefinition(&$definition, $plugin_id) {
  parent::processDefinition($definition, $plugin_id);

  // @todo Remove this check once http://drupal.org/node/1780396 is resolved.
  if (!module_exists($definition['module'])) {
    $definition = NULL;
    return;
  }
  foreach ($definition['view_modes'] as $view_mode => $view_mode_info) {
    $definition['view_modes'][$view_mode] += array(
      'custom_settings' => FALSE,
    );
  }

  // If no bundle key is provided, assume a single bundle, named after
  // the entity type.
  if (empty($definition['entity_keys']['bundle']) && empty($definition['bundles'])) {
    $definition['bundles'] = array(
      $plugin_id => array(
        'label' => $definition['label'],
      ),
    );
  }

  // Prepare entity schema fields SQL info for
  // Drupal\Core\Entity\DatabaseStorageControllerInterface::buildQuery().
  if (isset($definition['base_table'])) {
    $definition['schema_fields_sql']['base_table'] = drupal_schema_fields_sql($definition['base_table']);
    if (isset($definition['revision_table'])) {
      $definition['schema_fields_sql']['revision_table'] = drupal_schema_fields_sql($definition['revision_table']);
    }
  }
}