class ImageStyleListBuilder
Same name and namespace in other branches
- 11.x core/modules/image/src/ImageStyleListBuilder.php \Drupal\image\ImageStyleListBuilder
- 10 core/modules/image/src/ImageStyleListBuilder.php \Drupal\image\ImageStyleListBuilder
- 9 core/modules/image/src/ImageStyleListBuilder.php \Drupal\image\ImageStyleListBuilder
- 8.9.x core/modules/image/src/ImageStyleListBuilder.php \Drupal\image\ImageStyleListBuilder
Defines a class to build a listing of image style entities.
Hierarchy
- class \Drupal\Core\Entity\EntityHandlerBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Entity\EntityListBuilder implements \Drupal\Core\Entity\EntityListBuilderInterface, \Drupal\Core\Entity\EntityHandlerInterface uses \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait extends \Drupal\Core\Entity\EntityHandlerBase
- class \Drupal\Core\Config\Entity\ConfigEntityListBuilder extends \Drupal\Core\Entity\EntityListBuilder
- class \Drupal\image\ImageStyleListBuilder extends \Drupal\Core\Config\Entity\ConfigEntityListBuilder
- class \Drupal\Core\Config\Entity\ConfigEntityListBuilder extends \Drupal\Core\Entity\EntityListBuilder
- class \Drupal\Core\Entity\EntityListBuilder implements \Drupal\Core\Entity\EntityListBuilderInterface, \Drupal\Core\Entity\EntityHandlerInterface uses \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait extends \Drupal\Core\Entity\EntityHandlerBase
Expanded class hierarchy of ImageStyleListBuilder
See also
\Drupal\image\Entity\ImageStyle
1 file declares its use of ImageStyleListBuilder
- ImageStyle.php in core/
modules/ image/ src/ Entity/ ImageStyle.php
File
-
core/
modules/ image/ src/ ImageStyleListBuilder.php, line 15
Namespace
Drupal\imageView source
class ImageStyleListBuilder extends ConfigEntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['label'] = $this->t('Style name');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity->label();
return $row + parent::buildRow($entity);
}
/**
* {@inheritdoc}
*/
protected function getDefaultOperations(EntityInterface $entity) {
$args = func_get_args();
$cacheability = $args[1] ?? new CacheableMetadata();
$flush = [
'title' => $this->t('Flush'),
'weight' => 200,
'url' => $entity->toUrl('flush-form'),
];
return parent::getDefaultOperations($entity, $cacheability) + [
'flush' => $flush,
];
}
/**
* {@inheritdoc}
*/
public function render() {
$build = parent::render();
$build['table']['#empty'] = $this->t('There are currently no styles. <a href=":url">Add a new one</a>.', [
':url' => Url::fromRoute('image.style_add')->toString(),
]);
return $build;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.