Open onyxnz opened 1 year ago
You've actually found a bug in Backdrop's core! The form callback installer_browser_install_button_form()
in installer.pages.inc
should not assign $form['#attributes']['class'] = 'installer-browser-install-button-form';
, but rather $form['#attributes']['class'][] = 'installer-browser-install-button-form';
Will open an issue in the core queue.
In addition to fixing the issue in core, I believe there are better ways for this module to test that the form being altered is the node_form
. For starters, instead of checking for a specific class, which is bound to change at any point, it should use a hook_form_FORM_ID_alter()
instead.
/**
* Implements hook_form_FORM_ID_alter().
*/
function scheduler_form_node_form_alter(&$form, $form_state) {
// Load the real code only when needed. First check that the user has permission to use Scheduler.
if (user_access('schedule publishing of nodes')) {
// Check if scheduling has been enabled for this node type.
$publishing_enabled = config_get('node.type.' . $form['type']['#value'], 'scheduler_publish_enable') == 1;
$unpublishing_enabled = config_get('node.type.' . $form['type']['#value'], 'scheduler_unpublish_enable') == 1;
if ($publishing_enabled || $unpublishing_enabled) {
module_load_include('inc', 'scheduler', 'scheduler.edit');
_scheduler_form_alter($form, $form_state);
}
}
}
The way it's done it's probably legacy code from Drupal 6.
If I try to install another module while scheduler is active I'll get this error message:
TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in in_array() (line 194 of /mypath/modules/scheduler/scheduler.module).
Does this belong to the same reason or should I create a new issue @argiepiano ?
That's the same bug. The fix has not been yet merged into Backdrop.
The core issue is merged. RE: https://github.com/backdrop-contrib/scheduler/issues/22#issuecomment-1630749173 -- I agree!
because is_array is not checked first.