public function buildUi(MediaLibraryState
$state = NULL
) { if (!
$state) { $state = MediaLibraryState::
fromRequest($this->request
);
} // When navigating to a media type through the vertical tabs, we only want
// to load the changed library content. This is not only more efficient, but
// also provides a more accessible user experience for screen readers.
if ($state->
get('media_library_content'
) === '1'
) { return $this->
buildLibraryContent($state);
} else { return [ '#theme' => 'media_library_wrapper',
'#attributes' =>
[ 'id' => 'media-library-wrapper',
],
'menu' =>
$this->
buildMediaTypeMenu($state),
'content' =>
$this->
buildLibraryContent($state),
// Attach the JavaScript for the media library UI. The number of
// available slots needs to be added to make sure users can't select