You are here

public function PanelsPaneController::attachLoad in Fieldable Panels Panes (FPP) 7

Attaches data to entities upon loading.

This will attach fields, if the entity is fieldable. It calls hook_entity_load() for modules which need to add data to all entities. It also calls hook_TYPE_load() on the loaded entities. For example hook_node_load() or hook_user_load(). If your hook_TYPE_load() expects special parameters apart from the queried entities, you can set $this->hookLoadArguments prior to calling the method. See NodeController::attachLoad() for an example.

Parameters

$queried_entities: Associative array of query results, keyed on the entity ID.

$revision_id: ID of the revision that was loaded, or FALSE if the most current revision was loaded.

Overrides DrupalDefaultEntityController::attachLoad

File

includes/PanelsPaneController.class.php, line 45
Contains the controller class for the Fieldable Panel Pane entity.

Class

PanelsPaneController
Entity controller class.

Code

public function attachLoad(&$queried_entities, $revision_id = FALSE) {
  parent::attachLoad($queried_entities, $revision_id);

  // We need to go through and unserialize our serialized fields.
  if (!empty($queried_entities)) {
    foreach ($queried_entities as $entity) {
      foreach (array(
        'view_access',
        'edit_access',
      ) as $key) {
        if (is_string($entity->{$key})) {
          $entity->{$key} = unserialize($entity->{$key});
        }
      }
    }
  }
}