You are here

function __check_bundle in Exif 8

Same name and namespace in other branches
  1. 8.2 exif.drush.inc \__check_bundle()

Look for exif entity types.

Parameters

array $entity_types: names of entity_types to check.

string $type: type to check.

Return value

array

2 calls to __check_bundle()
drush_exif_import in ./exif.drush.inc
drush_exif_update in ./exif.drush.inc
Implements Drush callback.

File

./exif.drush.inc, line 219
Drush extension allowing to run some tasks related to exif.

Code

function __check_bundle($entity_types, $type) {
  $types = __drush_exif_list_active_types($entity_types);
  $selected_types = [];
  if ($type === '') {
    $selected_types = $types;
  }
  else {
    foreach ($entity_types as $entity_type) {
      $item = [
        'entity' => $entity_type,
        'type' => $type,
      ];
      if (in_array($item, $types)) {
        $selected_types[] = $item;
      }
    }
    if (count($selected_types) == 0) {
      drush_log(dt('type %type is not in exif active types.', [
        '%type' => $type,
      ]), "error");
      drush_log(dt('exif active types are  :'), "error");
      foreach ($types as $type) {
        $params = [
          '%entity' => $type['entity'],
          '%type' => $type['type'],
        ];
        drush_log(dt('  * %entity, %type', $params), 'error');
      }
    }
  }
  return $selected_types;
}