Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • project/dashboards
  • issue/dashboards-3205095
  • issue/dashboards-3205096
  • issue/dashboards-3205269
  • issue/dashboards-3161955
  • issue/dashboards-3277778
  • issue/dashboards-3295719
  • issue/dashboards-3132349
  • issue/dashboards-3330023
  • issue/dashboards-3334514
  • issue/dashboards-3347975
  • issue/dashboards-3349570
  • issue/dashboards-3352151
  • issue/dashboards-3351661
  • issue/dashboards-3353660
  • issue/dashboards-3354493
  • issue/dashboards-3356296
  • issue/dashboards-3356327
  • issue/dashboards-3362260
  • issue/dashboards-3366586
  • issue/dashboards-3366951
  • issue/dashboards-3409306
  • issue/dashboards-3439495
  • issue/dashboards-3277709
  • issue/dashboards-3429751
  • issue/dashboards-3432048
  • issue/dashboards-3413086
  • issue/dashboards-3432759
  • issue/dashboards-3433312
  • issue/dashboards-3444736
  • issue/dashboards-3454509
  • issue/dashboards-3457907
  • issue/dashboards-3483234
  • issue/dashboards-3501454
34 results
Show changes
Showing
with 121 additions and 77 deletions
...@@ -2,24 +2,26 @@ ...@@ -2,24 +2,26 @@
namespace Drupal\dashboards\Form; namespace Drupal\dashboards\Form;
use Drupal\dashboards\Entity\Dashboard;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Block\BlockManagerInterface; use Drupal\Core\Block\BlockManagerInterface;
use Drupal\Core\Layout\LayoutPluginManagerInterface;
use Drupal\Core\Plugin\Context\ContextHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\layout_builder_restrictions\Traits\PluginHelperTrait;
use Drupal\Core\DependencyInjection\DependencySerializationTrait; use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Layout\LayoutPluginManagerInterface;
use Drupal\Core\Plugin\Context\ContextHandlerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\dashboards\Entity\Dashboard;
use Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface; use Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface;
use Drupal\layout_builder_restrictions\Traits\PluginHelperTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Supplement form UI to add setting for which blocks & layouts are available. * Supplement form UI to add setting for which blocks & layouts are available.
*/ */
class FormAlter implements ContainerInjectionInterface { class FormAlter implements ContainerInjectionInterface {
use PluginHelperTrait;
use DependencySerializationTrait; use DependencySerializationTrait;
use PluginHelperTrait;
use StringTranslationTrait;
/** /**
* The section storage manager. * The section storage manager.
...@@ -65,7 +67,7 @@ class FormAlter implements ContainerInjectionInterface { ...@@ -65,7 +67,7 @@ class FormAlter implements ContainerInjectionInterface {
SectionStorageManagerInterface $section_storage_manager, SectionStorageManagerInterface $section_storage_manager,
BlockManagerInterface $block_manager, BlockManagerInterface $block_manager,
LayoutPluginManagerInterface $layout_manager, LayoutPluginManagerInterface $layout_manager,
ContextHandlerInterface $context_handler ContextHandlerInterface $context_handler,
) { ) {
$this->sectionStorageManager = $section_storage_manager; $this->sectionStorageManager = $section_storage_manager;
$this->blockManager = $block_manager; $this->blockManager = $block_manager;
...@@ -89,7 +91,10 @@ class FormAlter implements ContainerInjectionInterface { ...@@ -89,7 +91,10 @@ class FormAlter implements ContainerInjectionInterface {
* The actual form elements. * The actual form elements.
*/ */
public function alterEntityViewDisplayFormAllowedBlockCategories(&$form, FormStateInterface $form_state, $form_id) { public function alterEntityViewDisplayFormAllowedBlockCategories(&$form, FormStateInterface $form_state, $form_id) {
$display = $form_state->getFormObject()->getEntity(); /** @var \Drupal\dashboards\Form\DashboardForm $dashboard_form */
$dashboard_form = $form_state->getFormObject();
/** @var \Drupal\dashboards\Entity\Dashboard $display */
$display = $dashboard_form->getEntity();
$is_enabled = $display->isLayoutBuilderEnabled(); $is_enabled = $display->isLayoutBuilderEnabled();
if ($is_enabled) { if ($is_enabled) {
$form['#entity_builders'][] = [$this, 'entityFormEntityBuild']; $form['#entity_builders'][] = [$this, 'entityFormEntityBuild'];
...@@ -115,7 +120,10 @@ class FormAlter implements ContainerInjectionInterface { ...@@ -115,7 +120,10 @@ class FormAlter implements ContainerInjectionInterface {
* The actual form elements. * The actual form elements.
*/ */
public function alterEntityViewDisplayForm(&$form, FormStateInterface $form_state, $form_id) { public function alterEntityViewDisplayForm(&$form, FormStateInterface $form_state, $form_id) {
$entity = $form_state->getFormObject()->getEntity(); /** @var \Drupal\dashboards\Form\DashboardForm $dashboard_form */
$dashboard_form = $form_state->getFormObject();
/** @var \Drupal\dashboards\Entity\Dashboard $entity */
$entity = $dashboard_form->getEntity();
$is_enabled = $entity->isLayoutBuilderEnabled(); $is_enabled = $entity->isLayoutBuilderEnabled();
if ($is_enabled) { if ($is_enabled) {
$form['#entity_builders'][] = [$this, 'entityFormEntityBuild']; $form['#entity_builders'][] = [$this, 'entityFormEntityBuild'];
...@@ -375,7 +383,7 @@ class FormAlter implements ContainerInjectionInterface { ...@@ -375,7 +383,7 @@ class FormAlter implements ContainerInjectionInterface {
// Create a whitelist of categories whose blocks should be allowed. // Create a whitelist of categories whose blocks should be allowed.
// Newly available categories' blocks not in this list will be // Newly available categories' blocks not in this list will be
// disallowed. // disallowed.
$allowed_block_categories = array_keys($this->getBlockDefinitions($display)); $allowed_block_categories = array_keys($this->getBlockDefinitions());
} }
else { else {
// The UI choice indicates that all newly available categories' // The UI choice indicates that all newly available categories'
......
...@@ -12,7 +12,7 @@ use Drupal\layout_builder\SectionStorageInterface; ...@@ -12,7 +12,7 @@ use Drupal\layout_builder\SectionStorageInterface;
trait LayoutBuilderRestrictionHelperTrait { trait LayoutBuilderRestrictionHelperTrait {
/** /**
* Check if sotrage is a dashboard storage. * Check if storage is a dashboard storage.
* *
* @param \Drupal\layout_builder\SectionStorageInterface $section * @param \Drupal\layout_builder\SectionStorageInterface $section
* Section storage. * Section storage.
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
namespace Drupal\dashboards\Layouts; namespace Drupal\dashboards\Layouts;
use Drupal\Core\Layout\LayoutDefault;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Layout\LayoutDefault;
use Drupal\Core\Plugin\PluginFormInterface; use Drupal\Core\Plugin\PluginFormInterface;
/** /**
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
namespace Drupal\dashboards\Plugin\Block; namespace Drupal\dashboards\Plugin\Block;
use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\Block\BlockBase; use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Block\BlockPluginInterface; use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Component\Plugin\PluginManagerInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -35,7 +35,7 @@ class DashboardBlock extends BlockBase implements ContainerFactoryPluginInterfac ...@@ -35,7 +35,7 @@ class DashboardBlock extends BlockBase implements ContainerFactoryPluginInterfac
array $configuration, array $configuration,
$plugin_id, $plugin_id,
$plugin_definition, $plugin_definition,
PluginManagerInterface $plugin_manager PluginManagerInterface $plugin_manager,
) { ) {
parent::__construct($configuration, $plugin_id, $plugin_definition); parent::__construct($configuration, $plugin_id, $plugin_definition);
$id = explode(':', $this->getDerivativeId())[1]; $id = explode(':', $this->getDerivativeId())[1];
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
namespace Drupal\dashboards\Plugin\Dashboard; namespace Drupal\dashboards\Plugin\Dashboard;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\user\Entity\User; use Drupal\Core\Entity\EntityDisplayRepositoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountInterface;
use Drupal\dashboards\Plugin\DashboardBase; use Drupal\dashboards\Plugin\DashboardBase;
use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\user\Entity\User;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
namespace Drupal\dashboards\Plugin\Dashboard; namespace Drupal\dashboards\Plugin\Dashboard;
use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\dashboards\Plugin\DashboardBase;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RedirectDestinationInterface; use Drupal\Core\Routing\RedirectDestinationInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
use Drupal\dashboards\Plugin\DashboardBase;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
...@@ -62,7 +62,7 @@ class AddContentMenu extends DashboardBase { ...@@ -62,7 +62,7 @@ class AddContentMenu extends DashboardBase {
AccountInterface $account, AccountInterface $account,
EntityTypeManagerInterface $entity_type_manager, EntityTypeManagerInterface $entity_type_manager,
EntityTypeBundleInfoInterface $bundle_info, EntityTypeBundleInfoInterface $bundle_info,
RedirectDestinationInterface $destination RedirectDestinationInterface $destination,
) { ) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $cache); parent::__construct($configuration, $plugin_id, $plugin_definition, $cache);
$this->account = $account; $this->account = $account;
......
...@@ -4,6 +4,7 @@ namespace Drupal\dashboards\Plugin\Dashboard; ...@@ -4,6 +4,7 @@ namespace Drupal\dashboards\Plugin\Dashboard;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\dashboards\Plugin\DashboardBase; use Drupal\dashboards\Plugin\DashboardBase;
...@@ -29,12 +30,27 @@ class ErrorReport extends DashboardBase { ...@@ -29,12 +30,27 @@ class ErrorReport extends DashboardBase {
*/ */
protected $database; protected $database;
/**
* Module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function __construct(array $configuration, $plugin_id, $plugin_definition, CacheBackendInterface $cache, Connection $connection) { public function __construct(
array $configuration,
$plugin_id,
$plugin_definition,
CacheBackendInterface $cache,
Connection $connection,
ModuleHandlerInterface $module_handler,
) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $cache); parent::__construct($configuration, $plugin_id, $plugin_definition, $cache);
$this->database = $connection; $this->database = $connection;
$this->moduleHandler = $module_handler;
} }
/** /**
...@@ -47,6 +63,7 @@ class ErrorReport extends DashboardBase { ...@@ -47,6 +63,7 @@ class ErrorReport extends DashboardBase {
$plugin_definition, $plugin_definition,
$container->get('dashboards.cache'), $container->get('dashboards.cache'),
$container->get('database'), $container->get('database'),
$container->get('module_handler')
); );
} }
...@@ -54,7 +71,7 @@ class ErrorReport extends DashboardBase { ...@@ -54,7 +71,7 @@ class ErrorReport extends DashboardBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function buildRenderArray($configuration): array { public function buildRenderArray($configuration): array {
if (!\Drupal::moduleHandler()->moduleExists('dblog')) { if (!$this->moduleHandler->moduleExists('dblog')) {
return [ return [
'#theme' => 'dashboards_admin_list', '#theme' => 'dashboards_admin_list',
'#list' => [ '#list' => [
...@@ -76,7 +93,7 @@ class ErrorReport extends DashboardBase { ...@@ -76,7 +93,7 @@ class ErrorReport extends DashboardBase {
$query->groupBy('severity'); $query->groupBy('severity');
$result = $query->execute()->fetchAll(); $result = $query->execute()->fetchAll();
$criticals = array_reduce($result, function ($before, $v) { $critical = array_reduce($result, function ($before, $v) {
if ($v->severity < LOG_ERR) { if ($v->severity < LOG_ERR) {
return $before + $v->severity_count; return $before + $v->severity_count;
} }
...@@ -98,9 +115,9 @@ class ErrorReport extends DashboardBase { ...@@ -98,9 +115,9 @@ class ErrorReport extends DashboardBase {
}, 0); }, 0);
$list = [ $list = [
'criticals' => [ 'critical' => [
'text' => 'Criticals', 'text' => 'Critical',
'count' => $criticals, 'count' => $critical,
'severity' => 'error', 'severity' => 'error',
'query' => [0, 1, 2], 'query' => [0, 1, 2],
], ],
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
namespace Drupal\dashboards\Plugin\Dashboard; namespace Drupal\dashboards\Plugin\Dashboard;
use Drupal\Core\Form\FormStateInterface;
use Drupal\dashboards\Plugin\DashboardBase;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\Query\QueryAggregateInterface; use Drupal\Core\Entity\Query\QueryAggregateInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\dashboards\Plugin\DashboardBase;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
......
...@@ -5,6 +5,7 @@ namespace Drupal\dashboards\Plugin\Dashboard; ...@@ -5,6 +5,7 @@ namespace Drupal\dashboards\Plugin\Dashboard;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Query\PagerSelectExtender; use Drupal\Core\Database\Query\PagerSelectExtender;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\dashboards\Plugin\DashboardBase; use Drupal\dashboards\Plugin\DashboardBase;
...@@ -30,12 +31,27 @@ class ReportNotFound extends DashboardBase { ...@@ -30,12 +31,27 @@ class ReportNotFound extends DashboardBase {
*/ */
protected $database; protected $database;
/**
* Module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function __construct(array $configuration, $plugin_id, $plugin_definition, CacheBackendInterface $cache, Connection $connection) { public function __construct(
array $configuration,
$plugin_id,
$plugin_definition,
CacheBackendInterface $cache,
Connection $connection,
ModuleHandlerInterface $module_handler,
) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $cache); parent::__construct($configuration, $plugin_id, $plugin_definition, $cache);
$this->database = $connection; $this->database = $connection;
$this->moduleHandler = $module_handler;
} }
/** /**
...@@ -47,7 +63,8 @@ class ReportNotFound extends DashboardBase { ...@@ -47,7 +63,8 @@ class ReportNotFound extends DashboardBase {
$plugin_id, $plugin_id,
$plugin_definition, $plugin_definition,
$container->get('dashboards.cache'), $container->get('dashboards.cache'),
$container->get('database') $container->get('database'),
$container->get('module_handler')
); );
} }
...@@ -55,7 +72,7 @@ class ReportNotFound extends DashboardBase { ...@@ -55,7 +72,7 @@ class ReportNotFound extends DashboardBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function buildRenderArray($configuration): array { public function buildRenderArray($configuration): array {
if (!\Drupal::moduleHandler()->moduleExists('dblog')) { if (!$this->moduleHandler->moduleExists('dblog')) {
return [ return [
'#theme' => 'dashboards_admin_list', '#theme' => 'dashboards_admin_list',
'#list' => [ '#list' => [
...@@ -80,6 +97,7 @@ class ReportNotFound extends DashboardBase { ...@@ -80,6 +97,7 @@ class ReportNotFound extends DashboardBase {
->groupBy('variables') ->groupBy('variables')
->orderBy('count', 'DESC'); ->orderBy('count', 'DESC');
$query = $query->extend(PagerSelectExtender::class); $query = $query->extend(PagerSelectExtender::class);
/** @var \Drupal\Core\Database\Query\PagerSelectExtender $query */
$query = $query->limit(5); $query = $query->limit(5);
$query->setCountQuery($count_query); $query->setCountQuery($count_query);
$result = $query->execute()->fetchAll(); $result = $query->execute()->fetchAll();
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
namespace Drupal\dashboards\Plugin\Dashboard; namespace Drupal\dashboards\Plugin\Dashboard;
use Drupal\Core\Url;
use Laminas\Feed\Reader\Reader;
use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\dashboards\Plugin\DashboardBase; use Drupal\dashboards\Plugin\DashboardBase;
use Drupal\dashboards\Plugin\DashboardLazyBuildBase; use Drupal\dashboards\Plugin\DashboardLazyBuildBase;
use Laminas\Feed\Reader\ExtensionManager; use Laminas\Feed\Reader\ExtensionManager;
use Laminas\Feed\Reader\ExtensionPluginManager; use Laminas\Feed\Reader\ExtensionPluginManager;
use Laminas\Feed\Reader\Reader;
/** /**
* Show account info. * Show account info.
...@@ -44,9 +44,7 @@ class RssNews extends DashboardLazyBuildBase { ...@@ -44,9 +44,7 @@ class RssNews extends DashboardLazyBuildBase {
$cache = \Drupal::service('dashboards.cache'); $cache = \Drupal::service('dashboards.cache');
$cid = $plugin_id . ':' . md5($uri); $cid = $plugin_id . ':' . md5($uri);
if (!($data = $cache->get($cid))) { if (!($data = $cache->get($cid))) {
$extensions = new ExtensionPluginManager( $extensions = new ExtensionPluginManager();
\Drupal::getContainer()
);
Reader::setExtensionManager(new ExtensionManager($extensions)); Reader::setExtensionManager(new ExtensionManager($extensions));
$client = \Drupal::httpClient(); $client = \Drupal::httpClient();
......
...@@ -65,7 +65,7 @@ class StatusUpdates extends DashboardBase { ...@@ -65,7 +65,7 @@ class StatusUpdates extends DashboardBase {
'message' => [ 'message' => [
'#type' => 'html_tag', '#type' => 'html_tag',
'#tag' => 'h3', '#tag' => 'h3',
'#value' => $this->t('Please enable update module'), '#value' => $this->t('This feature requires the Core Update module to be enabled.'),
], ],
], ],
]; ];
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
namespace Drupal\dashboards\Plugin\Dashboard; namespace Drupal\dashboards\Plugin\Dashboard;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\views\Views;
use Drupal\views\Entity\View;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\Query\QueryInterface; use Drupal\Core\Entity\Query\QueryInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\dashboards\Plugin\DashboardBase; use Drupal\dashboards\Plugin\DashboardBase;
use Drupal\views\Entity\View;
use Drupal\views\Views;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
...@@ -68,7 +68,7 @@ class ViewEmbed extends DashboardBase { ...@@ -68,7 +68,7 @@ class ViewEmbed extends DashboardBase {
*/ */
public function validateForm(array $form, FormStateInterface $form_state, array $configuration): void { public function validateForm(array $form, FormStateInterface $form_state, array $configuration): void {
if (!$form_state->getValue('view')) { if (!$form_state->getValue('view')) {
$form_state->setErrorByName('view', $this->t('Please provide a view.')); $form_state->setErrorByName('view', $this->t('Requires a view to be provided.'));
} }
} }
...@@ -98,7 +98,7 @@ class ViewEmbed extends DashboardBase { ...@@ -98,7 +98,7 @@ class ViewEmbed extends DashboardBase {
if (empty($options)) { if (empty($options)) {
$form['view'] = [ $form['view'] = [
'#markup' => $this->t('Please add a embed view to use this plugin.'), '#markup' => $this->t('Requires an embed view to be added for this plugin to be used.'),
]; ];
return $form; return $form;
} }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
namespace Drupal\dashboards\Plugin; namespace Drupal\dashboards\Plugin;
use Drupal\Component\Plugin\PluginBase; use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -112,7 +112,7 @@ abstract class DashboardBase extends PluginBase implements DashboardInterface, C ...@@ -112,7 +112,7 @@ abstract class DashboardBase extends PluginBase implements DashboardInterface, C
} }
/** /**
* Set a new cache entry. Cache is prefixed by pluginid. * Set a new cache entry. Cache is prefixed by plugin ID.
* *
* @param string $cid * @param string $cid
* Cache id. * Cache id.
......
...@@ -26,7 +26,7 @@ interface DashboardLazyBuildInterface { ...@@ -26,7 +26,7 @@ interface DashboardLazyBuildInterface {
* @param string $pluginId * @param string $pluginId
* Dashboard plugin id. * Dashboard plugin id.
* @param string $configuration * @param string $configuration
* Serizalized configuration. * Serialized configuration.
* *
* @return array * @return array
* Renderable array * Renderable array
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
namespace Drupal\dashboards\Plugin; namespace Drupal\dashboards\Plugin;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
/** /**
* Provides the Dashboard plugin manager. * Provides the Dashboard plugin manager.
......
...@@ -4,8 +4,8 @@ namespace Drupal\dashboards\Plugin\Derivative; ...@@ -4,8 +4,8 @@ namespace Drupal\dashboards\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DeriverBase; use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Component\Plugin\PluginManagerInterface; use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
......
...@@ -3,14 +3,16 @@ ...@@ -3,14 +3,16 @@
namespace Drupal\dashboards\Plugin\LayoutBuilderRestriction; namespace Drupal\dashboards\Plugin\LayoutBuilderRestriction;
use Drupal\Core\Config\Entity\ThirdPartySettingsInterface; use Drupal\Core\Config\Entity\ThirdPartySettingsInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\dashboards\LayoutBuilderRestrictionHelperTrait; use Drupal\dashboards\LayoutBuilderRestrictionHelperTrait;
use Drupal\layout_builder_restrictions\Plugin\LayoutBuilderRestrictionBase;
use Drupal\layout_builder\SectionStorageInterface; use Drupal\layout_builder\SectionStorageInterface;
use Drupal\layout_builder_restrictions\Plugin\LayoutBuilderRestrictionBase;
use Drupal\layout_builder_restrictions\Traits\PluginHelperTrait; use Drupal\layout_builder_restrictions\Traits\PluginHelperTrait;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
// cspell:ignore Allowedin
// Ignore keyword 'Allowedin' used in module 'layout_builder_restrictions'.
/** /**
* Controls behavior of the per-view mode plugin. * Controls behavior of the per-view mode plugin.
* *
...@@ -53,11 +55,12 @@ class DashboardsViewModeRestriction extends LayoutBuilderRestrictionBase { ...@@ -53,11 +55,12 @@ class DashboardsViewModeRestriction extends LayoutBuilderRestrictionBase {
* @param \Drupal\Core\Database\Connection $connection * @param \Drupal\Core\Database\Connection $connection
* The database connection. * The database connection.
*/ */
public function __construct(array $configuration, public function __construct(
array $configuration,
$plugin_id, $plugin_id,
$plugin_definition, $plugin_definition,
ModuleHandlerInterface $module_handler, ModuleHandlerInterface $module_handler,
Connection $connection Connection $connection,
) { ) {
$this->configuration = $configuration; $this->configuration = $configuration;
$this->pluginId = $plugin_id; $this->pluginId = $plugin_id;
......
...@@ -2,24 +2,24 @@ ...@@ -2,24 +2,24 @@
namespace Drupal\dashboards\Plugin\SectionStorage; namespace Drupal\dashboards\Plugin\SectionStorage;
use Drupal\Core\Url;
use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResult;
use Drupal\dashboards\Entity\Dashboard;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Plugin\Context\EntityContext;
use Symfony\Component\Routing\RouteCollection;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Config\Entity\ThirdPartySettingsInterface;
use Drupal\Core\Cache\RefinableCacheableDependencyInterface; use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
use Drupal\Core\Config\Entity\ThirdPartySettingsInterface;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\Context\EntityContext;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;
use Drupal\dashboards\Entity\Dashboard;
use Drupal\layout_builder\Entity\SampleEntityGeneratorInterface; use Drupal\layout_builder\Entity\SampleEntityGeneratorInterface;
use Drupal\layout_builder\Plugin\SectionStorage\SectionStorageBase; use Drupal\layout_builder\Plugin\SectionStorage\SectionStorageBase;
use Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface; use Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface;
use Drupal\user\UserDataInterface; use Drupal\user\UserDataInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\RouteCollection;
/** /**
* Dashboard section storage. * Dashboard section storage.
...@@ -108,7 +108,7 @@ class DashboardSectionStorage extends SectionStorageBase implements ContainerFac ...@@ -108,7 +108,7 @@ class DashboardSectionStorage extends SectionStorageBase implements ContainerFac
SampleEntityGeneratorInterface $sample_entity_generator, SampleEntityGeneratorInterface $sample_entity_generator,
AccountInterface $current_user, AccountInterface $current_user,
SectionStorageManagerInterface $section_storage_manager, SectionStorageManagerInterface $section_storage_manager,
UserDataInterface $user_data UserDataInterface $user_data,
) { ) {
parent::__construct($configuration, $plugin_id, $plugin_definition); parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entity_type_manager; $this->entityTypeManager = $entity_type_manager;
...@@ -248,7 +248,7 @@ class DashboardSectionStorage extends SectionStorageBase implements ContainerFac ...@@ -248,7 +248,7 @@ class DashboardSectionStorage extends SectionStorageBase implements ContainerFac
*/ */
public function isApplicable(RefinableCacheableDependencyInterface $cacheability) { public function isApplicable(RefinableCacheableDependencyInterface $cacheability) {
$entity = $this->getContextValue(Dashboard::CONTEXT_TYPE); $entity = $this->getContextValue(Dashboard::CONTEXT_TYPE);
if (!$entity->isOverriden()) { if (!$entity->isOverridden()) {
$cacheability->addCacheableDependency($this); $cacheability->addCacheableDependency($this);
return TRUE; return TRUE;
} }
......
...@@ -4,12 +4,12 @@ namespace Drupal\dashboards\Plugin\SectionStorage; ...@@ -4,12 +4,12 @@ namespace Drupal\dashboards\Plugin\SectionStorage;
use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResult;
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\dashboards\Entity\Dashboard; use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Plugin\Context\EntityContext; use Drupal\Core\Plugin\Context\EntityContext;
use Symfony\Component\Routing\RouteCollection; use Drupal\Core\Session\AccountInterface;
use Drupal\dashboards\Entity\Dashboard;
use Drupal\layout_builder\TempStoreIdentifierInterface; use Drupal\layout_builder\TempStoreIdentifierInterface;
use Drupal\Core\Cache\RefinableCacheableDependencyInterface; use Symfony\Component\Routing\RouteCollection;
/** /**
* Class DashboardSectionStorage. * Class DashboardSectionStorage.
...@@ -69,7 +69,7 @@ class UserDashboardSectionStorage extends DashboardSectionStorage implements Tem ...@@ -69,7 +69,7 @@ class UserDashboardSectionStorage extends DashboardSectionStorage implements Tem
/** /**
* @var \Drupal\dashboards\Entity\Dashboard $entity * @var \Drupal\dashboards\Entity\Dashboard $entity
*/ */
if ($entity->isOverriden()) { if ($entity->isOverridden()) {
$entity->loadOverrides(); $entity->loadOverrides();
} }
$contexts[Dashboard::CONTEXT_TYPE] = EntityContext::fromEntity($entity); $contexts[Dashboard::CONTEXT_TYPE] = EntityContext::fromEntity($entity);
......
...@@ -158,7 +158,7 @@ class UiPageTest extends BrowserTestBase { ...@@ -158,7 +158,7 @@ class UiPageTest extends BrowserTestBase {
} }
/** /**
* Testing personlizing. * Testing personalizing.
*/ */
public function testPersonalizing(): void { public function testPersonalizing(): void {
$this->setupCreateDashboard(); $this->setupCreateDashboard();
...@@ -173,14 +173,14 @@ class UiPageTest extends BrowserTestBase { ...@@ -173,14 +173,14 @@ class UiPageTest extends BrowserTestBase {
/** /**
* Setup dashboard for testing purposes. * Setup dashboard for testing purposes.
*/ */
private function setupCreateDashboard($frontentEndOnly = 0) { private function setupCreateDashboard($frontendOnly = 0) {
$this->drupalLogin($this->adminUser); $this->drupalLogin($this->adminUser);
$this->drupalGet('admin/structure/dashboards'); $this->drupalGet('admin/structure/dashboards');
$this->clickLink('New dashboard'); $this->clickLink('New dashboard');
$this->submitForm([ $this->submitForm([
'id' => static::DASHBOARD_NAME, 'id' => static::DASHBOARD_NAME,
'admin_label' => static::DASHBOARD_NAME, 'admin_label' => static::DASHBOARD_NAME,
'frontend' => $frontentEndOnly, 'frontend' => $frontendOnly,
], 'Save'); ], 'Save');
$this->assertSession()->pageTextContains(static::DASHBOARD_NAME); $this->assertSession()->pageTextContains(static::DASHBOARD_NAME);
......