function FieldInstance::query
Return value
\Drupal\Core\Database\Query\SelectInterface
Overrides SqlBase::query
File
- 
              core/modules/ field/ src/ Plugin/ migrate/ source/ d7/ FieldInstance.php, line 59 
Class
- FieldInstance
- Drupal 7 field instances source from database.
Namespace
Drupal\field\Plugin\migrate\source\d7Code
public function query() {
  $query = $this->select('field_config_instance', 'fci')
    ->fields('fci')
    ->fields('fc', [
    'type',
    'translatable',
  ])
    ->condition('fc.active', 1)
    ->condition('fc.storage_active', 1)
    ->condition('fc.deleted', 0)
    ->condition('fci.deleted', 0);
  $query->join('field_config', 'fc', '[fci].[field_id] = [fc].[id]');
  // Optionally filter by entity type and bundle.
  if (isset($this->configuration['entity_type'])) {
    $query->condition('fci.entity_type', $this->configuration['entity_type']);
    if (isset($this->configuration['bundle'])) {
      $query->condition('fci.bundle', $this->configuration['bundle']);
    }
  }
  // The Title module fields are not migrated.
  if ($this->moduleExists('title')) {
    $title_fields = [
      'title_field',
      'name_field',
      'description_field',
      'subject_field',
    ];
    $query->condition('fc.field_name', $title_fields, 'NOT IN');
  }
  return $query;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
