You are here

public function QuickNodeCloneEntitySettingsForm::getSelectedBundles in Quick Node Clone 8

Returns the selected bundles on the form.

Parameters

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

Return value

array|mixed|null An array/mixed set of content types if there are any, or null.

Overrides QuickNodeCloneEntitySettingsFormInterface::getSelectedBundles

1 call to QuickNodeCloneEntitySettingsForm::getSelectedBundles()
QuickNodeCloneEntitySettingsForm::buildForm in src/Form/QuickNodeCloneEntitySettingsForm.php
Form constructor.

File

src/Form/QuickNodeCloneEntitySettingsForm.php, line 223

Class

QuickNodeCloneEntitySettingsForm
Abstract class to configure how entities are cloned.

Namespace

Drupal\quick_node_clone\Form

Code

public function getSelectedBundles(FormStateInterface $form_state) {
  $selected_types = NULL;
  $config_name = 'exclude.' . $this
    ->getEntityTypeId();
  if (!empty($form_state
    ->getValue('bundle_names'))) {
    $selected_types = $form_state
      ->getValue('bundle_names');
  }
  elseif (!empty($this
    ->getSettings($config_name)) && array_filter($this
    ->getSettings($config_name))) {
    $selected_types = $this
      ->getSettings($config_name);
  }
  return $selected_types;
}