Commit 3a4a974f authored by Gaus Surahman's avatar Gaus Surahman Committed by Gaus Surahman
Browse files

Issue #3262982 by gausarts, trickfun: [PHP8] array_intersect() does not accept...

Issue #3262982 by gausarts, trickfun: [PHP8] array_intersect() does not accept unknown named parameters
parent ee201ed1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line

Splide 1.0.2-dev, 2022-02-08
----------------------------
- Issue #3262982 by gausarts, trickfun: [PHP8] array_intersect() does not accept
  unknown named parameters.

Splide 1.0.0-dev, 2022-02-05
----------------------------
- Issue #3262034 by Grimreaper, gausarts: Support Auto Scroll plugin.
+7 −0
Original line number Diff line number Diff line
@@ -64,3 +64,10 @@ function splide_post_update_change_height_ratio_type() {
function splide_post_add_pagination_tab_options() {
  // Empty block to clear cache.
}

/**
 * Fixed for D10 `app.root` service removal.
 */
function splide_post_d10_app_root_service_removal() {
  // Empty block to clear cache.
}
+1 −1
Original line number Diff line number Diff line
@@ -16,4 +16,4 @@ services:
  splide.skin_manager:
    class: Drupal\splide\SplideSkinManager
    parent: default_plugin_manager
    arguments: ['@app.root', '@config.factory']
    arguments: ['%app.root%', '@config.factory']
+33 −7
Original line number Diff line number Diff line
@@ -524,15 +524,34 @@ class SplideAdmin implements SplideAdminInterface {
   * is possible to narrow the list to include only fields that are present on
   * every bundle.
   */
  public function getValidFieldOptions(array $bundles, string $target_type, array $valid_field_types = [
  public function getValidFieldOptions(
    array $bundles,
    string $target_type,
    array $valid_field_types = [
      'string',
      'text',
  ]) {
    ]): array {

    $storage = $this->manager->getEntityTypeManager()->getStorage('field_config');
    $candidate_fields = [];

    foreach ($bundles as $bundle) {
    // Fix for Views UI not recognizing Media bundles, unlike Formatters.
    if (empty($bundles) && $bundle_service = self::service('entity_type.bundle.info')) {
      $bundles = $bundle_service->getBundleInfo($target_type);
    }

    foreach ($bundles as $bundle => $label) {
      $candidate_fields[$bundle] = [];
      foreach ($this->entityFieldManager->getFieldDefinitions($target_type, $bundle) as $field) {
      $fields = $this->entityFieldManager->getFieldDefinitions($target_type, $bundle);

      if (empty($fields)) {
        $fields = $storage->loadByProperties([
          'entity_type' => $target_type,
          'bundle' => $bundle,
        ]);
      }

      foreach ((array) $fields as $field) {
        if (is_a($field, 'Drupal\field\Entity\FieldConfig') and in_array($field->getType(), $valid_field_types)) {
          $candidate_fields[$bundle][$field->getName()] = $field->getLabel();
        }
@@ -544,7 +563,7 @@ class SplideAdmin implements SplideAdminInterface {
      $valid_fields = reset($candidate_fields);
    }
    elseif (count($candidate_fields) > 1) {
      $valid_fields = call_user_func_array('array_intersect', $candidate_fields);
      $valid_fields = call_user_func_array('array_intersect', array_values($candidate_fields));
    }

    return $valid_fields;
@@ -557,4 +576,11 @@ class SplideAdmin implements SplideAdminInterface {
    $this->blazyAdmin->finalizeForm($form, $definition);
  }

  /**
   * Returns a wrapper to pass tests, or DI where adding params is troublesome.
   */
  private static function service($service) {
    return \Drupal::hasService($service) ? \Drupal::service($service) : NULL;
  }

}
+3 −3

File changed.

Contains only whitespace changes.