You are here

public function Breakpoint::getLayoutOptions in Bootstrap Layout Builder 1.x

Same name and namespace in other branches
  1. 2.x src/Entity/Breakpoint.php \Drupal\bootstrap_layout_builder\Entity\Breakpoint::getLayoutOptions()

File

src/Entity/Breakpoint.php, line 105

Class

Breakpoint
Defines the Breakpoint config entity.

Namespace

Drupal\bootstrap_layout_builder\Entity

Code

public function getLayoutOptions($layout_id) {
  $options = [];
  $query = $this
    ->entityTypeManager()
    ->getStorage('blb_layout_option')
    ->getQuery();
  $blb_options = $query
    ->condition('layout_id', $layout_id)
    ->sort('weight', 'ASC')
    ->execute();
  foreach ($blb_options as $option_id) {
    $option = $this
      ->entityTypeManager()
      ->getStorage('blb_layout_option')
      ->load($option_id);
    if (!in_array($this
      ->id(), $option
      ->getBreakpointsIds())) {
      continue;
    }
    $options[$option
      ->getStructureId()] = $option
      ->label();
  }
  return $options;
}