protected function CustomBlockStorageController::attachLoad

Overrides \Drupal\Core\Entity\DatabaseStorageController::attachLoad().

Overrides DatabaseStorageControllerNG::attachLoad

File

drupal/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockStorageController.php, line 50
Contains \Drupal\custom_block\CustomBlockStorageController.

Class

CustomBlockStorageController
Controller class for custom blocks.

Namespace

Drupal\custom_block

Code

protected function attachLoad(&$blocks, $load_revision = FALSE) {

  // Create an array of block types for passing as a load argument.
  // Note that blocks at this point are still \StdClass objects returned from
  // the database.
  foreach ($blocks as $id => $entity) {
    $types[$entity->type] = $entity->type;
  }

  // Besides the list of blocks, pass one additional argument to
  // hook_custom_block_load(), containing a list of block types that were
  // loaded.
  $this->hookLoadArguments = array(
    $types,
  );
  parent::attachLoad($blocks, $load_revision);
}