You are here

protected function AddMediaFormBase::getCardinality in Media Directories 2.x

Same name and namespace in other branches
  1. 8 modules/media_directories_ui/src/Form/AddMediaFormBase.php \Drupal\media_directories_ui\Form\AddMediaFormBase::getCardinality()

Get the current cardinality from the form state.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Return value

int The current cardinality, or -1 for unlimited.

3 calls to AddMediaFormBase::getCardinality()
AddMediaFormBase::buildForm in modules/media_directories_ui/src/Form/AddMediaFormBase.php
Form constructor.
AddMediaFormBase::submitForm in modules/media_directories_ui/src/Form/AddMediaFormBase.php
Form submission handler.
FileUploadForm::processUploadElement in modules/media_directories_ui/src/Form/FileUploadForm.php
Processes an upload (managed_file) element.

File

modules/media_directories_ui/src/Form/AddMediaFormBase.php, line 180

Class

AddMediaFormBase
Class AddMediaFormBase.

Namespace

Drupal\media_directories_ui\Form

Code

protected function getCardinality(FormStateInterface $form_state) {
  $cardinality = intval($form_state
    ->get('cardinality'));
  if ($cardinality == 0) {
    return -1;
  }
  return $cardinality;
}