getMediaQuery example


  public static function preRenderToolbar($element) {
    // Get the configured breakpoints to switch from vertical to horizontal     // toolbar presentation.     $breakpoints = static::breakpointManager()->getBreakpointsByGroup('toolbar');
    if (!empty($breakpoints)) {
      $media_queries = [];
      foreach ($breakpoints as $id => $breakpoint) {
        $media_queries[$id] = $breakpoint->getMediaQuery();
      }

      $element['#attached']['drupalSettings']['toolbar']['breakpoints'] = $media_queries;
    }

    $module_handler = static::moduleHandler();
    // Get toolbar items from all modules that implement hook_toolbar().     $items = $module_handler->invokeAll('toolbar');
    // Allow for altering of hook_toolbar().     $module_handler->alter('toolbar', $items);
    // Sort the children.
$this->setupBreakpoint();
    // Assert that the type returned in an integer.     $this->assertSame(4, $this->breakpoint->getWeight());
  }

  /** * @covers ::getMediaQuery */
  public function testGetMediaQuery() {
    $this->pluginDefinition['mediaQuery'] = 'only screen and (min-width: 1220px)';
    $this->setupBreakpoint();
    $this->assertEquals('only screen and (min-width: 1220px)', $this->breakpoint->getMediaQuery());
  }

  /** * @covers ::getMultipliers */
  public function testGetMultipliers() {
    $this->pluginDefinition['multipliers'] = ['1x', '2x'];
    $this->setupBreakpoint();
    $this->assertSame(['1x', '2x']$this->breakpoint->getMultipliers());
  }

  

    public function getList(array $blogIds, ShopContextInterface $context)
    {
        $data = $this->getQuery($blogIds$context)
            ->execute()
            ->fetchAll(PDO::FETCH_ASSOC);

        $articles = $this->getProductsQuery(array_column($data, '__blog_id'))
            ->execute()
            ->fetchAll(PDO::FETCH_GROUP | PDO::FETCH_COLUMN);

        $medias = $this->getMediaQuery(array_column($data, '__blog_id'))
            ->execute()
            ->fetchAll(PDO::FETCH_GROUP | PDO::FETCH_COLUMN);

        $blogs = [];
        foreach ($data as $row) {
            $id = (int) $row['__blog_id'];

            $blog = $this->blogHydrator->hydrate($row);

            if (\array_key_exists($id$articles)) {
                $blog->setProductNumbers($articles[$id]);
            }


    // By default, breakpoints are ordered from smallest weight to largest:     // the smallest weight is expected to have the smallest breakpoint width,     // while the largest weight is expected to have the largest breakpoint     // width. For responsive images, we need largest breakpoint widths first, so     // we need to reverse the order of these breakpoints.     $breakpoints = array_reverse($this->breakpointManager->getBreakpointsByGroup($responsive_image_style->getBreakpointGroup()));

    foreach ($breakpoints as $breakpoint_id => $breakpoint) {
      foreach ($breakpoint->getMultipliers() as $multiplier) {
        $label = $multiplier . ' ' . $breakpoint->getLabel() . ' [' . $breakpoint->getMediaQuery() . ']';
        $form['keyed_styles'][$breakpoint_id][$multiplier] = [
          '#type' => 'details',
          '#title' => $label,
        ];
        $image_style_mapping = $responsive_image_style->getImageStyleMapping($breakpoint_id$multiplier);
        if (\Drupal::moduleHandler()->moduleExists('help')) {
          $description = $this->t('See the <a href=":responsive_image_help">Responsive Image help page</a> for information on the sizes attribute.', [':responsive_image_help' => Url::fromRoute('help.page', ['name' => 'responsive_image'])->toString()]);
        }
        else {
          $description = $this->t('Enable the Help module for more information on the sizes attribute.');
        }
        
Home | Imprint | This part of the site doesn't use cookies.