AbstractEntityEventVariables.php in Hook Event Dispatcher 8.2
File
modules/preprocess_event_dispatcher/src/Variables/AbstractEntityEventVariables.php
View source
<?php
namespace Drupal\preprocess_event_dispatcher\Variables;
use Drupal\Core\Entity\EntityInterface;
abstract class AbstractEntityEventVariables extends AbstractEventVariables {
public abstract function getEntity() : EntityInterface;
public function getEntityType() : string {
return $this
->get('theme_hook_original', '');
}
public function getEntityBundle() : string {
return $this
->getEntity()
->bundle();
}
public function getViewMode() : string {
return $this
->get('view_mode', '');
}
}