expandFieldString example


  public static function createFromQueryParameter($parameter) {
    if (empty($parameter)) {
      $cacheability = (new CacheableMetadata())->addCacheContexts(['url.query_args:sort']);
      throw new CacheableBadRequestHttpException($cacheability, 'You need to provide a value for the sort parameter.');
    }

    // Expand a JSON:API compliant sort into a more expressive sort parameter.     if (is_string($parameter)) {
      $parameter = static::expandFieldString($parameter);
    }

    // Expand any defaults into the sort array.     $expanded = [];
    foreach ($parameter as $sort_index => $sort_item) {
      $expanded[$sort_index] = static::expandItem($sort_item);
    }

    return new static($expanded);
  }

  
Home | Imprint | This part of the site doesn't use cookies.