You are here

protected function TinyPngImageHandler::shouldHandleEntity in TinyPNG 8

Checks if we should handle entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: Entity to check.

Return value

bool Returns TRUE if module configured and given entity is image.

1 call to TinyPngImageHandler::shouldHandleEntity()
TinyPngImageHandler::hookEntityPresave in src/TinyPngImageHandler.php
Implements hook_entity_presave().

File

src/TinyPngImageHandler.php, line 131

Class

TinyPngImageHandler
Class TinyPngImageHandler.

Namespace

Drupal\tinypng

Code

protected function shouldHandleEntity(EntityInterface $entity) {
  if (!$this
    ->checkConfig()) {
    return FALSE;
  }
  if (!$this
    ->checkEntity($entity)) {
    return FALSE;
  }

  /** @var \Drupal\file\FileInterface $entity */
  if (!$this
    ->checkFile($entity)) {
    return FALSE;
  }
  return TRUE;
}