function BlockVariantTrait::getRegionAssignments

Same name in other branches
  1. 8.x-3.x src/Plugin/BlockVariantTrait.php \Drupal\ctools\Plugin\BlockVariantTrait::getRegionAssignments()

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);
}