You are here

function units_ui_overview_uri in Units of Measurement 7.2

Same name and namespace in other branches
  1. 7 units_ui.pages.inc \units_ui_overview_uri()

Retrieve admin overview URI for a provided entity.

Parameters

Entity $entity: Entity whose overview URI should be determined

Return value

string Overview URI of the provided entity

4 calls to units_ui_overview_uri()
units_measure_form_delete_submit in ./units_ui.pages.inc
Submit handler for 'units_measure_form'.
units_measure_form_submit in ./units_ui.pages.inc
Submit handler for 'units_measure_form'.
units_unit_form_delete_submit in ./units_ui.pages.inc
Submit handler for 'units_unit_form'.
units_unit_form_submit in ./units_ui.pages.inc
Submit handler for 'units_unit_form'.

File

./units_ui.pages.inc, line 227
Menu page callbacks for Units UI module.

Code

function units_ui_overview_uri(Entity $entity) {
  $entity_info = entity_get_info($entity
    ->entityType());
  if (isset($entity_info['admin ui']['path'])) {
    $uri = $entity_info['admin ui']['path'];
    if (isset($entity_info['admin ui']['path bundle argument position'])) {
      $uri = explode('/', $uri);
      $bundle = entity_extract_ids($entity
        ->entityType(), $entity);
      $uri[$entity_info['admin ui']['path bundle argument position']] = $bundle[2];
      $uri = implode('/', $uri);
    }
    return $uri;
  }
  else {
    return '<front>';
  }
}