function MediaLibraryState::all

Returns the parameters.

@todo Remove this when Symfony 4 is no longer supported. See https://www.drupal.org/node/3162981

Parameters

string|null $key: The name of the parameter to return or null to get them all.

Return value

array An array of parameters.

2 calls to MediaLibraryState::all()
MediaLibraryState::getAllowedTypeIds in core/modules/media_library/src/MediaLibraryState.php
Returns the media type IDs which can be selected.
MediaLibraryState::getOpenerParameters in core/modules/media_library/src/MediaLibraryState.php
Returns all opener-specific parameter values.

File

core/modules/media_library/src/MediaLibraryState.php, line 286

Class

MediaLibraryState
A value object for the media library state.

Namespace

Drupal\media_library

Code

public function all(string $key = NULL) : array {
    if ($key === NULL) {
        return $this->parameters;
    }
    $value = $this->parameters[$key] ?? [];
    if (!is_array($value)) {
        throw new \UnexpectedValueException(sprintf('Unexpected value for parameter "%s": expecting "array", got "%s".', $key, get_debug_type($value)));
    }
    return $value;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.