You are here

function image_effects_post_update_text_overlay_strip_tags in Image Effects 8

Add 'strip_tags' and 'decode_entities' parameters to 'Text Overlay' effects.

File

./image_effects.post_update.php, line 42
Post-update functions for Image Effects.

Code

function image_effects_post_update_text_overlay_strip_tags() {
  foreach (ImageStyle::loadMultiple() as $image_style) {
    $edited = FALSE;
    foreach ($image_style
      ->getEffects() as $effect) {
      if ($effect
        ->getPluginId() === "image_effects_text_overlay") {
        $configuration = $effect
          ->getConfiguration();
        $configuration['data']['text']['strip_tags'] = TRUE;
        $configuration['data']['text']['decode_entities'] = TRUE;
        unset($configuration['data']['preview_bar']);
        $effect
          ->setConfiguration($configuration);
        $edited = TRUE;
      }
    }
    if ($edited) {
      $image_style
        ->save();
    }
  }
}