1 layout.class.inc Layout::getBlockPosition($block_uuid, $type = 'region')

Get a block's region position from a layout.

Parameters

string $block_uuid: The UUID of the block whose position is being retrieved.

string $type: Either "region" or "position". Defaults to "region".

Return value

string|int|FALSE: Returns either the region name or the position of the block within that region. If the block is not found at all, returns FALSE.

File

core/modules/layout/includes/layout.class.inc, line 586
Class for loading, modifying, and executing a layout.

Class

Layout
@file Class for loading, modifying, and executing a layout.

Code

function getBlockPosition($block_uuid, $type = 'region') {
  foreach ($this->positions as $region => $blocks) {
    foreach (array_values($blocks) as $position => $uuid) {
      if ($block_uuid === $uuid) {
        return $type === 'region' ? $region : $position;
      }
    }
  }
  return FALSE;
}