sortMappings example

/** * {@inheritdoc} */
  public function addImageStyleMapping($breakpoint_id$multiplier, array $image_style_mapping) {
    // If there is an existing mapping, overwrite it.     foreach ($this->image_style_mappings as &$mapping) {
      if ($mapping['breakpoint_id'] === $breakpoint_id && $mapping['multiplier'] === $multiplier) {
        $mapping = $image_style_mapping + [
          'breakpoint_id' => $breakpoint_id,
          'multiplier' => $multiplier,
        ];
        $this->sortMappings();
        return $this;
      }
    }
    $this->image_style_mappings[] = $image_style_mapping + [
      'breakpoint_id' => $breakpoint_id,
      'multiplier' => $multiplier,
    ];
    $this->sortMappings();
    return $this;
  }

  
Home | Imprint | This part of the site doesn't use cookies.