Skip to content
Snippets Groups Projects
Commit 490f8d1f authored by Jonathan Smith's avatar Jonathan Smith
Browse files

Issue #3331246 by jonathan1055: Drupal 10 compatibilty for Scheduler 8.x-1.x

parent 1c3a4a39
No related branches found
No related tags found
No related merge requests found
Showing
with 156 additions and 82 deletions
......@@ -21,24 +21,36 @@ jobs:
env:
- DRUPAL_CORE=8.9.x
# Skip Rules because it cannot be installed at 8.x.
- RULES=NO
# ---- Remaining self deprecation notices (0)
- php: 7.3
env:
- DRUPAL_CORE=9.1.x
# --- Remaining self deprecation notices (6)
# 6 StatementWrapper::fetchColumn (Rules)
# --- Remaining direct deprecation notices (0)
- RULES=YES
- DEPRECATIONS=6
# --- Remaining self deprecation notices (0)
# --- Remaining direct deprecation notices (0)
- php: 7.4
env:
- DRUPAL_CORE=9.2.x
- DRUPAL_CORE=9.5.x
# Skip Rules testing in this run.
# --- Remaining self deprecation notices ()
# 53 Use QueryInterface::accessCheck() (DevelGenerateTest and SchedulerApiTest)
# 1 BrowserTestBase::drupalGetHeader()
- RULES=NO
# --- Remaining self deprecation notices (0)
# --- Remaining direct deprecation notices (0)
- DEPRECATIONS=54
- php: 8.1
env:
- DRUPAL_CORE=10.0.x
- RULES=YES
# ---- Remaining self deprecation notices (4)
# 2 Behat\Mink\Element\ElementInterface::getText() might add "string"
# 2 Behat\Mink\Element\ElementInterface::waitFor() might add "mixed"
# ---- Remaining direct deprecation notices (3)
# 1 PHPUnit\TextUI\DefaultResultPrinter class is considered internal
# 1 DrupalListener implements "PHPUnit\Framework\TestListener
# 1 DrupalListener uses "PHPUnit\Framework\TestListenerDefaultImplementation"
# ---- Other deprecation notices (1)
# 1 PHPUnit\Framework\TestCase::addWarning() method is considered internal
- DEPRECATIONS=8
# Be sure to cache composer downloads.
cache:
......@@ -86,8 +98,8 @@ before_script:
fi
# Install the testing dependencies via Composer.
- travis_retry composer require drupal/devel:"^4"
- travis_retry composer require drush/drush:"^9 || ^10"
- travis_retry composer require drupal/devel
- travis_retry composer require drush/drush
- # Need to get Rules dev because 3.0.0-alpha7 has deprecation warnings.
- if [ "$RULES" == "YES" ]; then travis_retry composer require drupal/rules:"3.x-dev"; fi
# Use * to allow any compatible version, not the latest version.
......
......@@ -7,9 +7,7 @@
"require-dev": {
"drupal/rules": "^3",
"drush/drush": ">=9",
"drupal/devel_generate": "^2.0 || >=4",
"drupal/workbench_moderation": "^1.0",
"drupal/workbench_moderation_actions": "^1.0"
"drupal/devel_generate": "^2.0 || >=4"
},
"repositories": {
"drupal": {
......
......@@ -9,6 +9,7 @@ build:
host_command:
commands:
# Apply patch from https://www.drupal.org/project/drupalci_testbot/issues/3251817
# @todo Remove this when Drupal 9.4.9 and 9.5.0 and 10.0.0 have been released.
- "cd ${SOURCE_DIR} && sudo -u www-data curl https://www.drupal.org/files/issues/2021-11-30/3251817-4.run-tests-with-multiple-groups.patch | sudo -u www-data patch -p1 --verbose"
csslint:
eslint:
......@@ -18,19 +19,23 @@ build:
testing:
container_command:
commands:
# Rule 3.0-alpha7 is not compatible with PHP8.1 but the dev version has been fixed.
- "cd ${SOURCE_DIR} && sudo -u www-data composer require drupal/rules:3.x-dev"
- 'drush core:status | awk "NR==1{print \$0}"'
# Rules 3.0-alpha7 is not compatible with PHP8.1 but the dev version has been fixed.
# Added mglaman/phpstan-drupal:* to allow downgrade. See https://www.drupal.org/i/3326114
- "cd ${SOURCE_DIR} && sudo -u www-data composer require drupal/rules:3.x-dev mglaman/phpstan-drupal:*"
# Get workbench moderation modules only when testing with Drupal 9, as these are not compatible with Drupal 10.
# Use * because only the dev version of WBMA is compatible with D9.
- 'drush core:status | awk "NR==1{print \$2\$3\$4}"'
- 'drush core:status | awk "NR==1{print \$2\$3\$4}" | grep version:9 && sudo -u www-data composer require drupal/workbench_moderation drupal/workbench_moderation_actions:*'
# Show the eslint version
- "${SOURCE_DIR}/core/node_modules/.bin/eslint --version"
- 'echo "eslint version $(${SOURCE_DIR}/core/node_modules/.bin/eslint --version)"'
run_tests.functional:
types: 'PHPUnit-Functional'
testgroups: '--all'
# The groups are 'scheduler,scheduler_api,scheduler_rules_integration'
suppress-deprecations: true
suppress-deprecations: false
run_tests.js:
types: 'PHPUnit-FunctionalJavascript'
testgroups: 'scheduler_js'
suppress-deprecations: true
suppress-deprecations: false
concurrency: 1
halt-on-fail: false
name: Scheduler
type: module
description: 'Publish and unpublish content automatically on specified dates and times.'
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8 || ^9 || ^10
configure: scheduler.admin_form
dependencies:
- drupal:system (>= 8.5)
......@@ -13,8 +12,6 @@ dependencies:
test_dependencies:
- rules:rules
- devel:devel_generate
- workbench_moderation:workbench_moderation
- workbench_moderation_actions:workbench_moderation_actions
libraries:
- vertical-tabs
- default-time
......@@ -84,21 +84,20 @@ function scheduler_form_node_form_alter(&$form, FormStateInterface $form_state)
/** @var \Drupal\node\NodeInterface $node */
$node = $form_state->getFormObject()->getEntity();
/** @var \Drupal\scheduler\SchedulerManager $scheduler_manager */
$scheduler_manager = \Drupal::service('scheduler.manager');
// Invoke all implementations of hook_scheduler_hide_publish_on_field() to
// allow other modules to hide the field on the node edit form.
if ($publishing_enabled && $publishing_displayed) {
$hook = 'scheduler_hide_publish_on_field';
foreach (\Drupal::moduleHandler()->getImplementations($hook) as $module) {
$function = $module . '_' . $hook;
foreach ($scheduler_manager->getHookImplementations('hide_publish_on_field') as $function) {
$publishing_displayed = ($function($form, $form_state, $node) !== TRUE) && $publishing_displayed;
}
}
// Invoke all implementations of hook_scheduler_hide_unpublish_on_field() to
// allow other modules to hide the field on the node edit form.
if ($unpublishing_enabled && $unpublishing_displayed) {
$hook = 'scheduler_hide_unpublish_on_field';
foreach (\Drupal::moduleHandler()->getImplementations($hook) as $module) {
$function = $module . '_' . $hook;
foreach ($scheduler_manager->getHookImplementations('hide_unpublish_on_field') as $function) {
$unpublishing_displayed = ($function($form, $form_state, $node) !== TRUE) && $unpublishing_displayed;
}
}
......@@ -603,9 +602,9 @@ function scheduler_cron() {
// Scheduler 7.x provided hook_scheduler_api() which has been replaced by
// event dispatching in 8.x. Display a warning in the log if any of these
// hooks still exist, so that admins and developers are informed.
foreach (Drupal::moduleHandler()->getImplementations('scheduler_api') as $module) {
\Drupal::logger('scheduler')->warning('Function %function has not been executed. In Drupal 8, implementations of hook_scheduler_api() should be replaced by Scheduler event listeners.', [
'%function' => $module . '_scheduler_api',
foreach ($scheduler_manager->getHookImplementations('api') as $function) {
\Drupal::logger('scheduler')->warning('Function %function has not been executed. Implementations of hook_scheduler_api() should be replaced by Scheduler event listeners.', [
'%function' => $function,
]);
}
......
name: Scheduler Rules Integration
type: module
description: 'Scheduler sub-module providing conditions, actions and events for use with the Rules module.'
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8 || ^9 || ^10
dependencies:
- rules:rules
- scheduler:scheduler
......@@ -2,6 +2,7 @@
namespace Drupal\scheduler_rules_integration\Plugin\Condition;
use Drupal\Core\Entity\EntityInterface;
use Drupal\rules\Core\RulesConditionBase;
/**
......@@ -24,11 +25,13 @@ class NodeIsScheduledForPublishing extends RulesConditionBase {
/**
* Determines whether a node is scheduled for publishing.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The node to be checked.
*
* @return bool
* TRUE if the node is scheduled for publishing, FALSE if not.
*/
protected function doEvaluate() {
$node = $this->getContextValue('node');
protected function doEvaluate(EntityInterface $node) {
return !empty($node->publish_on->value);
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\scheduler_rules_integration\Plugin\Condition;
use Drupal\Core\Entity\EntityInterface;
use Drupal\rules\Core\RulesConditionBase;
/**
......@@ -24,11 +25,13 @@ class NodeIsScheduledForUnpublishing extends RulesConditionBase {
/**
* Determines whether a node is scheduled for unpublishing.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The node to be checked.
*
* @return bool
* TRUE if the node is scheduled for unpublishing, FALSE if not.
*/
protected function doEvaluate() {
$node = $this->getContextValue('node');
protected function doEvaluate(EntityInterface $node) {
return !empty($node->unpublish_on->value);
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\scheduler_rules_integration\Plugin\Condition;
use Drupal\Core\Entity\EntityInterface;
use Drupal\rules\Core\RulesConditionBase;
/**
......@@ -24,12 +25,14 @@ class PublishingIsEnabled extends RulesConditionBase {
/**
* Determines whether scheduled publishing is enabled for this node type.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The node to be checked.
*
* @return bool
* TRUE if scheduled publishing is enabled for the content type of this
* node.
*/
public function evaluate() {
$node = $this->getContextValue('node');
protected function doEvaluate(EntityInterface $node) {
$config = \Drupal::config('scheduler.settings');
return ($node->type->entity->getThirdPartySetting('scheduler', 'publish_enable', $config->get('default_publish_enable')));
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\scheduler_rules_integration\Plugin\Condition;
use Drupal\Core\Entity\EntityInterface;
use Drupal\rules\Core\RulesConditionBase;
/**
......@@ -24,12 +25,14 @@ class UnpublishingIsEnabled extends RulesConditionBase {
/**
* Determines whether scheduled unpublishing is enabled for this node type.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The node to be checked.
*
* @return bool
* TRUE if scheduled unpublishing is enabled for the content type of this
* node.
*/
public function evaluate() {
$node = $this->getContextValue('node');
protected function doEvaluate(EntityInterface $node) {
$config = \Drupal::config('scheduler.settings');
return ($node->type->entity->getThirdPartySetting('scheduler', 'unpublish_enable', $config->get('default_unpublish_enable')));
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\scheduler_rules_integration\Plugin\RulesAction;
use Drupal\Core\Entity\EntityInterface;
use Drupal\rules\Core\RulesActionBase;
/**
......@@ -27,9 +28,11 @@ class PublishNow extends RulesActionBase {
* This action should really be provided by Rules or by Core, but it is not
* yet done (as of Aug 2016). Scheduler users need this action so we provide
* it here. It could be removed later when Rules or Core includes it.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The node to be published.
*/
public function doExecute() {
$node = $this->getContextValue('node');
public function doExecute(EntityInterface $node) {
$node->setPublished();
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\scheduler_rules_integration\Plugin\RulesAction;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Link;
use Drupal\Core\Url;
use Drupal\rules\Core\RulesActionBase;
......@@ -25,9 +26,11 @@ class RemovePublishingDate extends RulesActionBase {
/**
* Remove the publish_on date from the node.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The node from which to remove the scheduled date.
*/
public function doExecute() {
$node = $this->getContextValue('node');
public function doExecute(EntityInterface $node) {
$config = \Drupal::config('scheduler.settings');
if ($node->type->entity->getThirdPartySetting('scheduler', 'publish_enable', $config->get('default_publish_enable'))) {
$node->set('publish_on', NULL);
......
......@@ -2,6 +2,7 @@
namespace Drupal\scheduler_rules_integration\Plugin\RulesAction;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Link;
use Drupal\Core\Url;
use Drupal\rules\Core\RulesActionBase;
......@@ -25,9 +26,11 @@ class RemoveUnpublishingDate extends RulesActionBase {
/**
* Remove the unpublish_on date from the node.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The node from which to remove the scheduled date.
*/
public function doExecute() {
$node = $this->getContextValue('node');
public function doExecute(EntityInterface $node) {
$config = \Drupal::config('scheduler.settings');
if ($node->type->entity->getThirdPartySetting('scheduler', 'unpublish_enable', $config->get('default_unpublish_enable'))) {
$node->set('unpublish_on', NULL);
......
......@@ -2,6 +2,7 @@
namespace Drupal\scheduler_rules_integration\Plugin\RulesAction;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Link;
use Drupal\Core\Url;
use Drupal\rules\Core\RulesActionBase;
......@@ -29,10 +30,13 @@ class SetPublishingDate extends RulesActionBase {
/**
* Set the publish_on date for the node.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The node to be scheduled for publishing.
* @param int $date
* The date for publishing.
*/
public function doExecute() {
$node = $this->getContextValue('node');
$date = $this->getContextValue('date');
public function doExecute(EntityInterface $node, int $date) {
$config = \Drupal::config('scheduler.settings');
if ($node->type->entity->getThirdPartySetting('scheduler', 'publish_enable', $config->get('default_publish_enable'))) {
$node->set('publish_on', $date);
......
......@@ -2,6 +2,7 @@
namespace Drupal\scheduler_rules_integration\Plugin\RulesAction;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Link;
use Drupal\Core\Url;
use Drupal\rules\Core\RulesActionBase;
......@@ -29,10 +30,13 @@ class SetUnpublishingDate extends RulesActionBase {
/**
* Set the unpublish_on date for the node.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The node to be scheduled for unpublishing.
* @param int $date
* The date for unpublishing.
*/
public function doExecute() {
$node = $this->getContextValue('node');
$date = $this->getContextValue('date');
public function doExecute(EntityInterface $node, int $date) {
$config = \Drupal::config('scheduler.settings');
if ($node->type->entity->getThirdPartySetting('scheduler', 'unpublish_enable', $config->get('default_unpublish_enable'))) {
$node->set('unpublish_on', $date);
......
......@@ -2,6 +2,7 @@
namespace Drupal\scheduler_rules_integration\Plugin\RulesAction;
use Drupal\Core\Entity\EntityInterface;
use Drupal\rules\Core\RulesActionBase;
/**
......@@ -27,9 +28,11 @@ class UnpublishNow extends RulesActionBase {
* This action should really be provided by Rules or by Core, but it is not
* yet done (as of Aug 2016). Scheduler users need this action so we provide
* it here. It could be removed later when Rules or Core includes it.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The node to be unpublished.
*/
public function doExecute() {
$node = $this->getContextValue('node');
public function doExecute(EntityInterface $node) {
$node->setUnpublished();
}
......
<?php
namespace Drupal\Tests\scheduler\Functional;
namespace Drupal\Tests\scheduler_rules_integration\Functional;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\scheduler\Functional\SchedulerBrowserTestBase;
/**
* Tests the six actions that Scheduler provides for use in Rules module.
......@@ -27,6 +28,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase {
$this->rulesStorage = $this->container->get('entity_type.manager')->getStorage('rules_reaction_rule');
$this->expressionManager = $this->container->get('plugin.manager.rules_expression');
// Login as adminUser so that we can also test the non-enabled node type.
$this->drupalLogin($this->adminUser);
// Create node A which is published and enabled for Scheduling.
......@@ -203,7 +205,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase {
->condition('severity', RfcLogLevel::WARNING)
->countQuery()
->execute()
->fetchColumn();
->fetchField();
$this->assertEquals(1, $log, 'There is 1 watchdog warning message from Scheduler');
// Fourthly, edit a pre-existing node which is not enabled for Scheduler.
......@@ -227,7 +229,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase {
->condition('severity', RfcLogLevel::WARNING)
->countQuery()
->execute()
->fetchColumn();
->fetchField();
$this->assertEquals(2, $log, 'There are now 2 watchdog warning messages from Scheduler');
// Edit the node, triggering rule 2.
......@@ -246,7 +248,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase {
->condition('severity', RfcLogLevel::WARNING)
->countQuery()
->execute()
->fetchColumn();
->fetchField();
$this->assertEquals(3, $log, 'There are now 3 watchdog warning messages from Scheduler');
}
......@@ -407,7 +409,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase {
->condition('severity', RfcLogLevel::WARNING)
->countQuery()
->execute()
->fetchColumn();
->fetchField();
$this->assertEquals(1, $log, 'There is 1 watchdog warning message from Scheduler');
// Fourthly, edit a pre-existing node which is not enabled for Scheduler.
......@@ -431,7 +433,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase {
->condition('severity', RfcLogLevel::WARNING)
->countQuery()
->execute()
->fetchColumn();
->fetchField();
$this->assertEquals(2, $log, 'There are now 2 watchdog warning messages from Scheduler');
// Edit the node, triggering rule 4.
......@@ -450,7 +452,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase {
->condition('severity', RfcLogLevel::WARNING)
->countQuery()
->execute()
->fetchColumn();
->fetchField();
$this->assertEquals(3, $log, 'There are now 3 watchdog warning messages from Scheduler');
}
......
<?php
namespace Drupal\Tests\scheduler\Functional;
namespace Drupal\Tests\scheduler_rules_integration\Functional;
use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\scheduler\Functional\SchedulerBrowserTestBase;
/**
* Tests the four conditions that Scheduler provides for use in Rules module.
......
<?php
namespace Drupal\Tests\scheduler\Functional;
namespace Drupal\Tests\scheduler_rules_integration\Functional;
use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\scheduler\Functional\SchedulerBrowserTestBase;
/**
* Tests the six events that Scheduler provides for use in Rules module.
......@@ -144,7 +145,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase {
// will be processed during cron, and assert that only event 3 is triggered.
sleep(5);
$this->cronRun();
$this->drupalGet('admin/reports/dblog');
$this->drupalGet('node');
$assert->pageTextNotContains($this->message[1]);
$assert->pageTextNotContains($this->message[2]);
$assert->pageTextContains($this->message[3]);
......@@ -195,7 +196,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase {
// will be processed during cron, and assert that only event 6 is triggered.
sleep(5);
$this->cronRun();
$this->drupalGet('admin/reports/dblog');
$this->drupalGet('node');
$assert->pageTextNotContains($this->message[1]);
$assert->pageTextNotContains($this->message[2]);
$assert->pageTextNotContains($this->message[3]);
......@@ -249,7 +250,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase {
// be processed during cron, and assert that events 3, 5 & 6 are triggered.
sleep(6);
$this->cronRun();
$this->drupalGet('admin/reports/dblog');
$this->drupalGet('node');
$assert->pageTextNotContains($this->message[1]);
$assert->pageTextNotContains($this->message[2]);
$assert->pageTextContains($this->message[3]);
......
......@@ -119,6 +119,38 @@ class SchedulerManager {
}
}
/**
* Returns an array of function names implemented for a specific hook.
*
* @param string $hook
* The identifier of the hook function, for example 'publish_action' or
* 'allow_unpublishing' or 'hide_publish_on_field'.
*
* @return array
* An array of callable function names for the implementations of this hook
* function for the type of entity being processed.
*/
public function getHookImplementations(string $hook) {
// Find all modules that implement these hooks, then append the $hookName to
// the end of the module, thus giving the full function name.
$all_hook_implementations = [];
$hookName = "scheduler_$hook";
if (version_compare(\Drupal::VERSION, '9.4', '>=')) {
// getImplementations() is deprecated in D9.4, use invokeAllWith().
$this->moduleHandler->invokeAllWith($hookName, function (callable $hook, string $module) use ($hookName, &$all_hook_implementations) {
$all_hook_implementations[] = $module . "_" . $hookName;
});
}
else {
// Use getImplementations() to maintain compatibility with Drupal 8.9.
$implementations = $this->moduleHandler->getImplementations($hookName);
array_walk($implementations, function (&$module) use ($hookName, &$all_hook_implementations) {
$all_hook_implementations[] = $module . "_" . $hookName;
});
}
return $all_hook_implementations;
}
/**
* Publish scheduled nodes.
*
......@@ -236,11 +268,10 @@ class SchedulerManager {
// Invoke all implementations of hook_scheduler_publish_action() to
// allow other modules to do the "publishing" process instead of
// Scheduler.
$hook = 'scheduler_publish_action';
$hook = 'publish_action';
$processed = FALSE;
$failed = FALSE;
foreach ($this->moduleHandler->getImplementations($hook) as $module) {
$function = $module . '_' . $hook;
foreach ($this->getHookImplementations($hook) as $function) {
$return = $function($node);
$processed = $processed || ($return === 1);
$failed = $failed || ($return === -1);
......@@ -254,7 +285,7 @@ class SchedulerManager {
'@type' => $node_type->label(),
'%title' => $node->getTitle(),
'link' => $node_type_link->toString() . ' ' . $view_link->toString(),
'@hook' => 'hook_' . $hook,
'@hook' => 'hook_scheduler_' . $hook,
];
if ($failed) {
......@@ -423,11 +454,10 @@ class SchedulerManager {
// Invoke all implementations of hook_scheduler_unpublish_action() to
// allow other modules to do the "unpublishing" process instead of
// Scheduler.
$hook = 'scheduler_unpublish_action';
$hook = 'unpublish_action';
$processed = FALSE;
$failed = FALSE;
foreach ($this->moduleHandler->getImplementations($hook) as $module) {
$function = $module . '_' . $hook;
foreach ($this->getHookImplementations($hook) as $function) {
$return = $function($node);
$processed = $processed || ($return === 1);
$failed = $failed || ($return === -1);
......@@ -441,7 +471,7 @@ class SchedulerManager {
'@type' => $node_type->label(),
'%title' => $node->getTitle(),
'link' => $node_type_link->toString() . ' ' . $view_link->toString(),
'@hook' => 'hook_' . $hook,
'@hook' => 'hook_scheduler_' . $hook,
];
if ($failed) {
......@@ -522,9 +552,8 @@ class SchedulerManager {
// Default to TRUE.
$result = TRUE;
// Check that other modules allow the action.
$hook = 'scheduler_allow_' . $action . 'ing';
foreach ($this->moduleHandler->getImplementations($hook) as $module) {
$function = $module . '_' . $hook;
$hook = 'allow_' . $action . 'ing';
foreach ($this->getHookImplementations($hook) as $function) {
$result &= $function($node);
}
......@@ -546,8 +575,7 @@ class SchedulerManager {
public function nidList($action) {
$nids = [];
foreach ($this->moduleHandler->getImplementations('scheduler_nid_list') as $module) {
$function = $module . '_scheduler_nid_list';
foreach ($this->getHookImplementations('nid_list') as $function) {
$nids = array_merge($nids, $function($action));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment