You are here

protected function MediaForm::saveMediaId in GridStack 8.2

Returns the selected media id, supports both upload and media library.

2 calls to MediaForm::saveMediaId()
Form::massageMetadata in src/Plugin/gridstack/stylizer/Form.php
Massages media metadata.
MediaForm::mediaElement in src/Plugin/gridstack/stylizer/MediaForm.php
Returns Media Library form elements adapted from MediaLibraryWidget.

File

src/Plugin/gridstack/stylizer/MediaForm.php, line 216

Class

MediaForm
Provides the media form for Layout Builder integration.

Namespace

Drupal\gridstack\Plugin\gridstack\stylizer

Code

protected function saveMediaId(array $settings, FormStateInterface $form_state) {
  $mid = isset($settings['target_id']) ? $settings['target_id'] : '';
  return empty($settings['media_library_selection']) ? $mid : $settings['media_library_selection'];
}