You are here

class CertificateEntityUIController in Certificate 7.3

Same name and namespace in other branches
  1. 8.3 certificate.classes.inc \CertificateEntityUIController

Custom Entity admin

Hierarchy

Expanded class hierarchy of CertificateEntityUIController

1 string reference to 'CertificateEntityUIController'
certificate_entity_info in ./certificate.module
Certificate Entity Support

File

./certificate.classes.inc, line 6

View source
class CertificateEntityUIController extends EntityBundleableUIController {
  public $overviewPagerLimit = 1000;
  protected function overviewTableRow($conditions, $id, $entity, $additional_cols = array()) {
    $rows = parent::overviewTableRow($conditions, $id, $entity, $additional_cols);
    $rows[] = l(t('PDF'), $this->path . '/preview/' . $id);
    return $rows;
  }
  protected function operationCount() {
    return parent::operationCount() + 1;
  }

  /**
   * Override the table that comes from EntityDefaultUIController so we can sort
   * it by label.
   */
  public function overviewTable($conditions = array()) {
    $table = parent::overviewTable($conditions);
    uasort($table['#rows'], array(
      $this,
      'labelSorter',
    ));
    return $table;
  }

  /**
   * uasort() callback to sort by label of a table row.
   */
  public function labelSorter($a, $b) {
    if (!isset($b[0]['data']['#label'])) {
      return -1;
    }
    if (!isset($a[0]['data']['#label'])) {
      return 1;
    }
    return strcasecmp($a[0]['data']['#label'], $b[0]['data']['#label']);
  }
  function hook_menu() {
    $items = parent::hook_menu();

    // Set this on the object so classes that extend hook_menu() can use it.
    $this->id_count = count(explode('/', $this->path));
    $plural_label = isset($this->entityInfo['plural label']) ? $this->entityInfo['plural label'] : $this->entityInfo['label'] . 's';
    $items[$this->path] = array(
      'title' => $plural_label,
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        $this->entityType . '_overview_form',
        $this->entityType,
      ),
      'description' => 'Manage ' . $plural_label . '.',
      'access callback' => 'entity_access',
      'access arguments' => array(
        'view',
        $this->entityType,
      ),
      'file' => 'includes/entity.ui.inc',
    );
    $items[$this->path . '/list'] = array(
      'title' => 'List',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    return $items;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CertificateEntityUIController::$overviewPagerLimit public property Defines the number of entries to show per page in overview table. Overrides EntityDefaultUIController::$overviewPagerLimit
CertificateEntityUIController::hook_menu function Provides definitions for implementing hook_menu(). Overrides EntityBundleableUIController::hook_menu
CertificateEntityUIController::labelSorter public function uasort() callback to sort by label of a table row.
CertificateEntityUIController::operationCount protected function Returns the operation count for calculating colspans. Overrides EntityDefaultUIController::operationCount
CertificateEntityUIController::overviewTable public function Override the table that comes from EntityDefaultUIController so we can sort it by label. Overrides EntityDefaultUIController::overviewTable
CertificateEntityUIController::overviewTableRow protected function Generates the row for the passed entity and may be overridden in order to customize the rows. Overrides EntityDefaultUIController::overviewTableRow
EntityContentUIController::operationFormSubmit public function Operation form submit callback. Overrides EntityDefaultUIController::operationFormSubmit
EntityDefaultUIController::$entityInfo protected property
EntityDefaultUIController::$entityType protected property
EntityDefaultUIController::$id_count protected property
EntityDefaultUIController::applyOperation public function Applies an operation to the given entity.
EntityDefaultUIController::entityFormSubmitBuildEntity public function Entity submit builder invoked via entity_ui_form_submit_build_entity().
EntityDefaultUIController::hook_forms public function Provides definitions for implementing hook_forms().
EntityDefaultUIController::operationForm public function Builds the operation form.
EntityDefaultUIController::operationFormValidate public function Operation form validation callback.
EntityDefaultUIController::overviewForm public function Builds the entity overview form.
EntityDefaultUIController::overviewFormSubmit public function Overview form submit callback.
EntityDefaultUIController::overviewFormValidate public function Overview form validation callback.
EntityDefaultUIController::overviewTableHeaders protected function Generates the table headers for the overview table.
EntityDefaultUIController::__construct public function