You are here

function tinypng_image_style_edit_form_builder in TinyPNG 8

Entity form builder to add the TinyPNG settings to ImageStyle.

Parameters

string $entity_type_id: Entity type ID.

\Drupal\image\ImageStyleInterface $image_style: Edited ImageStyle instance.

array $form: Entity form to alter.

\Drupal\Core\Form\FormStateInterface $form_state: Form state.

Throws

\Drupal\Core\Entity\EntityStorageException

1 string reference to 'tinypng_image_style_edit_form_builder'
tinypng_form_image_style_edit_form_alter in ./tinypng.module
Implements hook_form_FORM_ID_alter().

File

./tinypng.module, line 64
TinyPng module.

Code

function tinypng_image_style_edit_form_builder($entity_type_id, ImageStyleInterface $image_style, array &$form, FormStateInterface $form_state) {
  $image_style
    ->setThirdPartySetting('tinypng', 'tinypng_compress', $form_state
    ->getValue('tinypng_compress'));
  $image_style
    ->save();
}