You are here

public function MediaForm::getFieldCardinality in GridStack 8.2

Returns available field media definition.

1 call to MediaForm::getFieldCardinality()
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 119

Class

MediaForm
Provides the media form for Layout Builder integration.

Namespace

Drupal\gridstack\Plugin\gridstack\stylizer

Code

public function getFieldCardinality($name = '') {
  if ($definition = $this
    ->getFieldDefinition($name)) {
    return $definition
      ->getFieldStorageDefinition()
      ->getCardinality();
  }
  return -1;
}