restored the simplenews templating system for d8

This commit is contained in:
2021-08-18 00:05:12 +02:00
parent 4a32d5c2c4
commit f51f22491b
12 changed files with 727 additions and 3371 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace Drupal\materio_simplenews\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DeriverBase;
/**
* Defines dynamic local actions.
*/
class DynamicLocalActions extends DeriverBase {
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
// Implement dynamic logic to provide values for the same keys as in example.links.task.yml.
$newsletters = simplenews_newsletter_get_all();
foreach($newsletters as $news){
$this->derivatives['materio_simplenews.' . $news->id] = $base_plugin_definition;
$this->derivatives['materio_simplenews.' . $news->id]['title'] = $news->name;
$this->derivatives['materio_simplenews.' . $news->id]['route_name'] = 'node.add';
$this->derivatives['materio_simplenews.' . $news->id]['route_parameters']['node_type'] = 'simplenews_issue';
$this->derivatives['materio_simplenews.' . $news->id]['route_parameters']['newsletter'] = $news->id;
$this->derivatives['materio_simplenews.' . $news->id]['appears_on'] = ['view.simplenews_newsletters.page_1'];
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}