You are here

function _image_replace_style_options in Image Replace 8

Same name and namespace in other branches
  1. 7 image_replace.module \_image_replace_style_options()

Return a list of image replace enabled style => label map.

Return value

array A key-value list where keys are style names and values are style labels of image styles having a replace effect configured.

2 calls to _image_replace_style_options()
image_replace_form_field_config_edit_form_alter in ./image_replace.module
Implements hook_form_FORM_ID_alter() for 'field_config_edit_form'.
image_replace_form_field_config_edit_form_element_validate in ./image_replace.module
Form element validation callback.

File

./image_replace.module, line 198
Provides an image style effect replacing the whole image with another one.

Code

function _image_replace_style_options() {
  $styles = ImageStyle::loadMultiple();
  $result = [];
  foreach ($styles as $style_name => $style) {
    foreach ($style
      ->getEffects() as $effect) {
      if ($effect
        ->getPluginId() == 'image_replace') {
        $result[$style_name] = Html::escape($style
          ->get('label'));
      }
    }
  }
  return $result;
}