class FocalPointCollector in Acquia Content Hub 8.2
Add focal point dependencies.
@package Drupal\acquia_contenthub\EventSubscriber\DependencyCollector
Hierarchy
- class \Drupal\depcalc\EventSubscriber\DependencyCollector\BaseDependencyCollector implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\depcalc\EventSubscriber\DependencyCollector\EmbeddedImagesCollector
- class \Drupal\acquia_contenthub\EventSubscriber\DependencyCollector\FocalPointCollector
- class \Drupal\depcalc\EventSubscriber\DependencyCollector\EmbeddedImagesCollector
Expanded class hierarchy of FocalPointCollector
1 string reference to 'FocalPointCollector'
1 service uses FocalPointCollector
File
- src/
EventSubscriber/ DependencyCollector/ FocalPointCollector.php, line 15
Namespace
Drupal\acquia_contenthub\EventSubscriber\DependencyCollectorView source
class FocalPointCollector extends EmbeddedImagesCollector {
/**
* Reacts on CALCULATE_DEPENDENCIES event.
*
* @param \Drupal\depcalc\Event\CalculateEntityDependenciesEvent $event
* Event.
*
* @throws \Exception
*/
public function onCalculateDependencies(CalculateEntityDependenciesEvent $event) {
if (!$this->moduleHandler
->moduleExists('focal_point')) {
return;
}
elseif (!$this->moduleHandler
->moduleExists('file')) {
return;
}
$entity = $event
->getEntity();
if (FALSE === $entity instanceof ContentEntityInterface) {
return;
}
$files = $this
->getAttachedFiles($entity);
foreach ($files as $file) {
$find_crop = Crop::findCrop($file
->getFileUri(), 'focal_point');
if ($find_crop) {
$crop = Crop::load($find_crop
->id());
$this
->addDependency($event, $crop);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BaseDependencyCollector:: |
protected | function | Gets the dependency calculator. | |
BaseDependencyCollector:: |
protected | function | Properly adds dependencies and their modules to a wrapper object. | |
EmbeddedImagesCollector:: |
protected | property | Database connection. | |
EmbeddedImagesCollector:: |
protected | property | The module handler. | |
EmbeddedImagesCollector:: |
protected | function | Add dependency. | |
EmbeddedImagesCollector:: |
protected | function | Builds list of attached files. | |
EmbeddedImagesCollector:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
EmbeddedImagesCollector:: |
public | function | EmbeddedImagesCollector constructor. | |
FocalPointCollector:: |
public | function |
Reacts on CALCULATE_DEPENDENCIES event. Overrides EmbeddedImagesCollector:: |