You are here

function hook_image_effects_text_overlay_text_alter in Image Effects 8

Same name and namespace in other branches
  1. 8.3 image_effects.api.php \hook_image_effects_text_overlay_text_alter()
  2. 8.2 image_effects.api.php \hook_image_effects_text_overlay_text_alter()

Alter the text of a Text Overlay effect before overlaying on the image.

Parameters

string $text: The text string to be altered.

\Drupal\image\ConfigurableImageEffectBase $image_effect: The Text Overlay image effect plugin for which text need to be altered.

1 function implements hook_image_effects_text_overlay_text_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

image_effects_image_effects_text_overlay_text_alter in ./image_effects.module
Implements hook_image_effects_text_overlay_text_alter().
1 invocation of hook_image_effects_text_overlay_text_alter()
TextOverlayImageEffect::getAlteredText in src/Plugin/ImageEffect/TextOverlayImageEffect.php
Gets the text to overlay on the image, after all alterations.

File

./image_effects.api.php, line 18
API documentation for the Image Effects module.

Code

function hook_image_effects_text_overlay_text_alter(&$text, ConfigurableImageEffectBase $image_effect) {

  // Skip if the effect is not TextOverlayImageEffect or an alternative
  // implementation.
  if ($image_effect
    ->getPluginId() !== "image_effects_text_overlay") {
    return;
  }
  $text = 'my altered text';
}