Loading scheduler.module +44 −0 Changes for scheduler.module: 44 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1169,3 +1169,47 @@ function scheduler_migration_plugins_alter(array &$migrations) { $migrations[$plugin_id]['process']['third_party_settings/scheduler'] = 'scheduler_third_party_settings'; } } /** * Implements hook_local_tasks_alter(). */ function scheduler_local_tasks_alter(&$local_tasks) { // If the default local tasks for the overviews are also provided by another // module or by Core, then remove the ones added by Scheduler in // src/Plugin/Derivative/DynamicLocalTasks. This is to avoid duplicate links // if this core issue gets committed at some time. // @see https://www.drupal.org/project/drupal/issues/3199682 // Get the list of routes to check. $routes_to_check = \Drupal::service('scheduler.manager')->getCollectionRoutes(); // Find all the local tasks with the routes we are searching for and that have // a parent_id. These will be the links that are potential duplicates. $found = []; foreach ($local_tasks as $key => $value) { foreach ($routes_to_check as $route) { if ($value['route_name'] == $route && !empty($value['parent_id'])) { // Save the key of the $local_tasks array in a two level array, keyed on // the route and the module that provided it. $found[$route][$value['provider']] = $key; } } } // If there is more than one for any of the routes being checked then remove // the route added by Scheduler. foreach ($found as $route => $data) { if (count($data) > 1) { unset($local_tasks[$data['scheduler']]); unset($data['scheduler']); } // We assume that the duplicates are only caused by Scheduler. Other modules // could be causing more so log this and solve it later if it ever happens. if (count($data) > 1) { \Drupal::logger('scheduler')->warning('Local task route %route contains duplicates in addition to Scheduler. %data', [ '%route' => $route, '%data' => print_r($data, TRUE), ]); } } } src/Annotation/SchedulerPlugin.php +10 −0 Changes for src/Annotation/SchedulerPlugin.php: 10 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -66,6 +66,16 @@ class SchedulerPlugin extends Plugin { */ public $develGenerateForm = ''; /** * The route of the collection overview page. * * The default is entity.{$entityType}.collection so this property only needs * to be specified if that route is not the correct one. * * @var string */ public $collectionRoute; /** * The route of the scheduled view on the user profile page (optional). * Loading src/Plugin/Derivative/DynamicLocalTasks.php +1 −2 Changes for src/Plugin/Derivative/DynamicLocalTasks.php: 1 added line, 2 removed lines. Original line number Diff line number Diff line Loading @@ -40,14 +40,13 @@ class DynamicLocalTasks extends DeriverBase { // is required when adding additional local tasks. If that module is not // installed then define the tab here. This can be removed if // https://www.drupal.org/project/drupal/issues/3199682 gets committed. if (!\Drupal::moduleHandler()->moduleExists('content_moderation')) { // See also scheduler_local_tasks_alter(). $this->derivatives['scheduler.content_overview'] = [ 'title' => $this->t('Overview'), 'route_name' => 'system.admin_content', 'parent_id' => 'system.admin_content', ] + $base_plugin_definition; } } $view = View::load('scheduler_scheduled_media'); if ($view && $view->status() && $view->getDisplay('overview')) { Loading src/Plugin/Scheduler/NodeScheduler.php +1 −0 Changes for src/Plugin/Scheduler/NodeScheduler.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ use Drupal\scheduler\SchedulerPluginBase; * typeFieldName = "type", * dependency = "node", * develGenerateForm = "devel_generate_form_content", * collectionRoute = "system.admin_content", * userViewRoute = "view.scheduler_scheduled_content.user_page", * ) */ Loading src/Plugin/Scheduler/TaxonomyTermScheduler.php +1 −0 Changes for src/Plugin/Scheduler/TaxonomyTermScheduler.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ use Drupal\scheduler\SchedulerPluginBase; * typeFieldName = "vid", * dependency = "taxonomy", * develGenerateForm = "devel_generate_form_term", * collectionRoute = "entity.taxonomy_vocabulary.collection", * schedulerEventClass = "\Drupal\scheduler\Event\SchedulerTaxonomyTermEvents", * ) */ Loading Loading
scheduler.module +44 −0 Changes for scheduler.module: 44 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1169,3 +1169,47 @@ function scheduler_migration_plugins_alter(array &$migrations) { $migrations[$plugin_id]['process']['third_party_settings/scheduler'] = 'scheduler_third_party_settings'; } } /** * Implements hook_local_tasks_alter(). */ function scheduler_local_tasks_alter(&$local_tasks) { // If the default local tasks for the overviews are also provided by another // module or by Core, then remove the ones added by Scheduler in // src/Plugin/Derivative/DynamicLocalTasks. This is to avoid duplicate links // if this core issue gets committed at some time. // @see https://www.drupal.org/project/drupal/issues/3199682 // Get the list of routes to check. $routes_to_check = \Drupal::service('scheduler.manager')->getCollectionRoutes(); // Find all the local tasks with the routes we are searching for and that have // a parent_id. These will be the links that are potential duplicates. $found = []; foreach ($local_tasks as $key => $value) { foreach ($routes_to_check as $route) { if ($value['route_name'] == $route && !empty($value['parent_id'])) { // Save the key of the $local_tasks array in a two level array, keyed on // the route and the module that provided it. $found[$route][$value['provider']] = $key; } } } // If there is more than one for any of the routes being checked then remove // the route added by Scheduler. foreach ($found as $route => $data) { if (count($data) > 1) { unset($local_tasks[$data['scheduler']]); unset($data['scheduler']); } // We assume that the duplicates are only caused by Scheduler. Other modules // could be causing more so log this and solve it later if it ever happens. if (count($data) > 1) { \Drupal::logger('scheduler')->warning('Local task route %route contains duplicates in addition to Scheduler. %data', [ '%route' => $route, '%data' => print_r($data, TRUE), ]); } } }
src/Annotation/SchedulerPlugin.php +10 −0 Changes for src/Annotation/SchedulerPlugin.php: 10 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -66,6 +66,16 @@ class SchedulerPlugin extends Plugin { */ public $develGenerateForm = ''; /** * The route of the collection overview page. * * The default is entity.{$entityType}.collection so this property only needs * to be specified if that route is not the correct one. * * @var string */ public $collectionRoute; /** * The route of the scheduled view on the user profile page (optional). * Loading
src/Plugin/Derivative/DynamicLocalTasks.php +1 −2 Changes for src/Plugin/Derivative/DynamicLocalTasks.php: 1 added line, 2 removed lines. Original line number Diff line number Diff line Loading @@ -40,14 +40,13 @@ class DynamicLocalTasks extends DeriverBase { // is required when adding additional local tasks. If that module is not // installed then define the tab here. This can be removed if // https://www.drupal.org/project/drupal/issues/3199682 gets committed. if (!\Drupal::moduleHandler()->moduleExists('content_moderation')) { // See also scheduler_local_tasks_alter(). $this->derivatives['scheduler.content_overview'] = [ 'title' => $this->t('Overview'), 'route_name' => 'system.admin_content', 'parent_id' => 'system.admin_content', ] + $base_plugin_definition; } } $view = View::load('scheduler_scheduled_media'); if ($view && $view->status() && $view->getDisplay('overview')) { Loading
src/Plugin/Scheduler/NodeScheduler.php +1 −0 Changes for src/Plugin/Scheduler/NodeScheduler.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ use Drupal\scheduler\SchedulerPluginBase; * typeFieldName = "type", * dependency = "node", * develGenerateForm = "devel_generate_form_content", * collectionRoute = "system.admin_content", * userViewRoute = "view.scheduler_scheduled_content.user_page", * ) */ Loading
src/Plugin/Scheduler/TaxonomyTermScheduler.php +1 −0 Changes for src/Plugin/Scheduler/TaxonomyTermScheduler.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ use Drupal\scheduler\SchedulerPluginBase; * typeFieldName = "vid", * dependency = "taxonomy", * develGenerateForm = "devel_generate_form_term", * collectionRoute = "entity.taxonomy_vocabulary.collection", * schedulerEventClass = "\Drupal\scheduler\Event\SchedulerTaxonomyTermEvents", * ) */ Loading