You are here

public function SkinsAddForm::form in Skinr 8.2

Gets the actual form array to be built.

Overrides EntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

skinr_ui/src/Form/SkinsAddForm.php, line 39
Contains Drupal\skinr_ui\Form\SkinsAddForm.

Class

SkinsAddForm

Namespace

Drupal\skinr_ui\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $skin = $this->entity;
  $form['type'] = array(
    '#type' => 'select',
    '#title' => t('Type'),
    '#options' => skinr_get_config_info(),
    '#required' => TRUE,
  );
  $element_options = $this
    ->elementOptions();
  $form['element'] = array(
    '#type' => 'select',
    '#title' => t('Element'),
    '#options' => $element_options,
    '#required' => TRUE,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add'),
  );

  // @todo

  /*
  $form['#attached']['js'][] = drupal_get_path('module', 'skinr_ui') . '/js/skinr_ui.js';

  // Add settings for the update selects behavior.
  $form['#attached']['js'][] = array(
    'type' => 'setting',
    'data' => array('elementOptions' => $this->elementOptions()),
  );
  */
  return $form;
}