You are here

public function BlockVariantTrait::getRegionAssignments in Chaos Tool Suite (ctools) 8.3

See also

\Drupal\ctools\Plugin\BlockVariantInterface::getRegionAssignments()

File

src/Plugin/BlockVariantTrait.php, line 101

Class

BlockVariantTrait
Provides methods for \Drupal\ctools\Plugin\BlockVariantInterface.

Namespace

Drupal\ctools\Plugin

Code

public function getRegionAssignments() {

  // Build an array of the region names in the right order.
  $empty = array_fill_keys(array_keys($this
    ->getRegionNames()), []);
  $full = $this
    ->getBlockCollection()
    ->getAllByRegion();

  // Merge it with the actual values to maintain the ordering.
  return array_intersect_key(array_merge($empty, $full), $empty);
}