You are here

public function ConfigEntityCloneFormBase::getValues in Entity Clone 8

Get all new values provided by the specific form element.

Parameters

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

Return value

array An array containing all new values.

Overrides EntityCloneFormInterface::getValues

File

src/EntityClone/Config/ConfigEntityCloneFormBase.php, line 104

Class

ConfigEntityCloneFormBase
Class ConfigEntityCloneFormBase.

Namespace

Drupal\entity_clone\EntityClone\Config

Code

public function getValues(FormStateInterface $form_state) {

  // If entity must have a prefix
  // (e.g. entity_form_mode, entity_view_mode, ...).
  $field_prefix = '';
  if (isset($form_state
    ->getCompleteForm()['id']['#field_prefix'])) {
    $field_prefix = $form_state
      ->getCompleteForm()['id']['#field_prefix'];
  }
  return [
    'id' => $field_prefix . $form_state
      ->getValue('id'),
    'label' => $form_state
      ->getValue('label'),
  ];
}