Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I was getting...
Warning: in_array() expects parameter 2 to be array, boolean given in omega_page_attachments_alter() (line 119 of /path/to/themes/omega/omega/omega.theme).
.
Sorry for not creating a patch, but the error is here...
foreach ($toggleCSS as $libraryID => $data) {
// check it is actively enabled via Omega configurations and ensure it isn't already included
if ($data['status'] && !in_array($libraryID, $attachments['#attached']['library'])) {
// attach libraries as required
$attachments['#attached']['library'][] = $data['library'];
}
// !$data['status'] means the checkbox on the omega settings page is unticked
// in_array($libraryID, $attachments['#attached']['library'] means it is already in the $attachments array
// $data['allow_disable'] ensures that omega['allow_enable_disable'] was not set to false, meaning it should not be allowed to be disabled.
elseif(!$data['status'] && in_array($libraryID, $attachments['#attached']['library'] && $data['allow_disable'])) {
// here we have a library that was declared via THEME.info.yml as active,
// yet was disabled via Omega settings, so we need to remove it now.
$libraryArrayKey = array_search($libraryID, $attachments['#attached']['library']);
unset($attachments['#attached']['library'][$libraryArrayKey]);
}
}
.
The elseif has a misplaced ")". It should be...
elseif(!$data['status'] && in_array($libraryID, $attachments['#attached']['library']) && $data['allow_disable']) {
Comment | File | Size | Author |
---|---|---|---|
#3 | in_array_param_2-2712015.diff | 1.34 KB | himerus |
Comments
Comment #3
himerus CreditAttribution: himerus as a volunteer commentedLooks like that fixed the issue. Committed to dev, patch attached.