You are here

public function RefreshPageElementsHelper::getStatusMessagesBlockId in Commerce Ajax Add to Cart 8

Returns status messages block id for the active theme.

Return value

string|null The block id, NULL if the block is not placed for the active theme.

1 call to RefreshPageElementsHelper::getStatusMessagesBlockId()
RefreshPageElementsHelper::updateStatusMessages in src/RefreshPageElementsHelper.php
Refreshes status messages.

File

src/RefreshPageElementsHelper.php, line 96

Class

RefreshPageElementsHelper
Provides methods that would help in refreshing certain page elements.

Namespace

Drupal\dc_ajax_add_cart

Code

public function getStatusMessagesBlockId() {
  $active_theme = $this->themeManager
    ->getActiveTheme()
    ->getName();
  $query = $this->entityTypeManager
    ->getStorage('block')
    ->getQuery();
  $block_ids = $query
    ->condition('plugin', 'system_messages_block')
    ->condition('theme', $active_theme)
    ->execute();
  return array_shift($block_ids);
}