You are here

public function TextimageFactory::getTextimageStyleOptions in Textimage 8.4

Same name and namespace in other branches
  1. 8.3 src/TextimageFactory.php \Drupal\textimage\TextimageFactory::getTextimageStyleOptions()

Gets an array of Textimage image styles suitable for select list options.

Parameters

bool $limit_to_textimage: (optional) TRUE to limit styles to only those with Textimage effects.

Return value

string[] Array of image styles, where both key and value are set to style name.

Overrides TextimageFactoryInterface::getTextimageStyleOptions

File

src/TextimageFactory.php, line 208

Class

TextimageFactory
Provides a factory for Textimage.

Namespace

Drupal\textimage

Code

public function getTextimageStyleOptions($limit_to_textimage = FALSE) {
  $image_styles = ImageStyle::loadMultiple();
  $options = [];
  foreach ($image_styles as $name => $image_style) {
    if ($limit_to_textimage) {
      if ($this
        ->isTextimage($image_style)) {
        $options[$name] = $image_style
          ->label();
      }
    }
    else {
      $options[$name] = $image_style
        ->label();
    }
  }
  return $options;
}