BlazyListBuilderBase.php in Blazy 8.2
File
blazy_ui/src/Controller/BlazyListBuilderBase.php
View source
<?php
namespace Drupal\blazy_ui\Controller;
use Drupal\Core\Config\Entity\DraggableListBuilder;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\EntityInterface;
abstract class BlazyListBuilderBase extends DraggableListBuilder {
protected $manager;
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if (isset($operations['edit'])) {
$operations['edit']['title'] = $this
->t('Configure');
}
$operations['duplicate'] = [
'title' => $this
->t('Duplicate'),
'weight' => 15,
'url' => $entity
->toUrl('duplicate-form'),
];
if ($entity
->id() == 'default') {
unset($operations['delete'], $operations['edit']);
}
return $operations;
}
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$this
->messenger()
->addMessage($this
->t('The optionsets order has been updated.'));
}
}