Same name and namespace in other branches
  1. 2.x src/EntityClone/Config/ConfigEntityCloneFormBase.php \Drupal\entity_clone\EntityClone\Config\ConfigEntityCloneFormBase::getValues()

Overrides EntityCloneFormInterface::getValues

File

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

Class

ConfigEntityCloneFormBase
Class Config Entity Clone FormBase.

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'),
    ];
}