You are here

function drush_eck_entity_construction_kit_all in Entity Construction Kit (ECK) 7.2

Same name and namespace in other branches
  1. 7.3 includes/eck.drush.inc \drush_eck_entity_construction_kit_all()

Implements drush_hook_command().

Shows all entities, bundles, and fields.

File

includes/eck.drush.inc, line 124
Drush support for ECK.

Code

function drush_eck_entity_construction_kit_all() {
  $entity_types = EntityType::loadAll();
  if (empty($entity_types)) {
    return drush_log('Entity Constuction Kit does not have any entities.', 'warning');
  }
  $rows[] = array(
    '',
  );
  foreach ($entity_types as $entity_type) {
    $etlabel = $entity_type->label;
    $etname = $entity_type->name;
    $rows[] = array(
      '',
    );
    $rows[] = array(
      dt('Entity: '),
      $etlabel . ', ' . $etname,
    );
    $rows[] = array(
      '',
    );
    $rows[] = array(
      '',
    );
    foreach (Bundle::loadByEntityType($entity_type) as $bundle) {
      $rows = array_merge($rows, _eck_get_bundle($entity_type, $bundle));
    }
  }
  _eck_fix_underscores($rows);
  drush_print_table($rows, TRUE);
}