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']) {
CommentFileSizeAuthor
#3 in_array_param_2-2712015.diff1.34 KBhimerus
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ExTexan created an issue. See original summary.

  • himerus committed 88a6f16 on 8.x-5.x
    Issue #2712015: Warning: in_array() expects parameter 2 to be array;...
himerus’s picture

Status: Active » Fixed
FileSize
1.34 KB

Looks like that fixed the issue. Committed to dev, patch attached.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.