You are here

function eck__bundle__overview in Entity Construction Kit (ECK) 7

Page call back for the bundle overview table (to see and manipulate all created label of a given type)

Parameters

entity_type: (String) entity type

1 string reference to 'eck__bundle__overview'
eck__bundle__menu in ./eck.bundle.inc
This function creates the menu items relevant to bundle administration

File

./eck.bundle.inc, line 109
All of the menu, pages, and forms related to bundle administration.

Code

function eck__bundle__overview($entity_type) {
  module_load_include('inc', 'eck', 'eck.entity');
  $header = array(
    t('Type'),
    array(
      'data' => t('Operations'),
      'colspan' => '1',
    ),
  );
  $rows = array();
  foreach (eck__bundle__load($entity_type->name) as $bundle) {
    $bundle_label = $bundle->label;
    $admin_info = get_bundle_admin_info($entity_type->name, $bundle->name);
    $uri = $admin_info['path'];
    $rows[] = array(
      l($bundle_label, url($uri, array(
        'absolute' => TRUE,
      ))),
      l("delete", $uri . "/delete"),
    );
  }
  $build['bundle_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
  );
  $build['sample_code'] = array(
    '#theme' => 'form_element',
    '#title' => t('Optional entity class'),
    '#description' => t('You may add this custom class the entity. To create a new instance of this class programmatically call: %code', array(
      '%code' => "entity_create('{$entity_type->name}', array());",
    )),
    '#children' => "<pre>" . check_plain("class " . eck_get_class_name($entity_type->name, 'EntityType') . " extends Entity{\n\n}") . "</pre>",
  );
  return $build;
}