You are here

protected function EntityPagerSetup::establishEntity in Entity Pager 7

Establish Entity.

Use View result to establish the Entity type of interest. i.e. a node entity or a user entity etc.. Then load that type of entity from the menu object. Then store all the information that has been worked out so it can be conveniently and efficiently used by this Class.

Parameters

object $view: The view object.

1 call to EntityPagerSetup::establishEntity()
EntityPagerSetup::__construct in includes/EntityPagerSetup.inc
Setup Entity Pager with minimum values to work with.

File

includes/EntityPagerSetup.inc, line 342
General setup base Class for Entity Pager module.

Class

EntityPagerSetup
Class EntityPagerSetup.

Code

protected function establishEntity($view) {
  $entity_info = $this
    ->establishEntityInfo($view);
  $position = 1 + substr_count($entity_info['entity_type'], '_');

  // Position is normally 1, (e.g. node/8 ), but things like taxonomy_term
  // get turned into taxonomy/term (e.g. taxonomy/term/8).
  $entity = menu_get_object($entity_info['entity_type'], $position);
  $this
    ->setEntity($entity);
  $this
    ->setEntityInfo($entity_info);
  $this
    ->setIdFieldName();
}