media_pdf_thumbnail.module in Media PDF Thumbnail 8
Same filename and directory in other branches
Contains media_pdf_thumbnail.module.
File
media_pdf_thumbnail.moduleView source
<?php
/**
* @file
* Contains media_pdf_thumbnail.module.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*
* @inheritdoc
*/
function media_pdf_thumbnail_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the adimeo_pdf_thumbnail module.
case 'help.page.media_pdf_thumbnail':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Generate a thumbnail image from a pdf file in media entity') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_ENTITY_TYPE_presave().
*
* @inheritdoc
*/
function media_pdf_thumbnail_media_presave(EntityInterface $entity) {
Drupal::service('media_pdf_thumbnail.image.manager')
->createThumbnail($entity);
}
Functions
Name | Description |
---|---|
media_pdf_thumbnail_help | Implements hook_help(). |
media_pdf_thumbnail_media_presave | Implements hook_ENTITY_TYPE_presave(). |