class ImageModuleTestHooks

Hook implementations for image_module_test.

Hierarchy

Expanded class hierarchy of ImageModuleTestHooks

File

core/modules/image/tests/modules/image_module_test/src/Hook/ImageModuleTestHooks.php, line 13

Namespace

Drupal\image_module_test\Hook
View source
class ImageModuleTestHooks {
    
    /**
     * Implements hook_image_effect_info_alter().
     */
    public function imageEffectInfoAlter(&$effects) {
        $state = \Drupal::state();
        // The 'image_module_test.counter' state variable value is set and accessed
        // from the ImageEffectsTest::testImageEffectsCaching() test and used to
        // signal if the image effect plugin definitions were computed or were
        // retrieved from the cache.
        // @see \Drupal\Tests\image\Kernel\ImageEffectsTest::testImageEffectsCaching()
        $counter = $state->get('image_module_test.counter');
        // Increase the test counter, signaling that image effects were processed,
        // rather than being served from the cache.
        $state->set('image_module_test.counter', ++$counter);
    }
    
    /**
     * Implements hook_image_style_presave().
     *
     * Used to save test third party settings in the image style entity.
     */
    public function imageStylePresave(ImageStyleInterface $style) {
        $style->setThirdPartySetting('image_module_test', 'foo', 'bar');
    }
    
    /**
     * Implements hook_image_style_flush().
     */
    public function imageStyleFlush($style, $path = NULL) {
        $state = \Drupal::state();
        $state->set('image_module_test_image_style_flush.called', $path);
    }

}

Members

Title Sort descending Modifiers Object type Summary
ImageModuleTestHooks::imageEffectInfoAlter public function Implements hook_image_effect_info_alter().
ImageModuleTestHooks::imageStyleFlush public function Implements hook_image_style_flush().
ImageModuleTestHooks::imageStylePresave public function Implements hook_image_style_presave().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.