config_packager-8.x-1.x-dev/src/Form/AssignmentCoreForm.php

src/Form/AssignmentCoreForm.php
<?php

/**
 * @file
 * Contains \Drupal\config_packager\Form\AssignmentCoreForm.
 */

namespace Drupal\config_packager\Form;

use Drupal\config_packager\Form\AssignmentFormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Configures the selected configuration assignment method for this site.
 */
class AssignmentCoreForm extends AssignmentFormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormID() {
    return 'config_packager_assignment_core_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {

    $defaults = $this->configFactory->get('config_packager.assignment')->get('core.types');
    $this->setTypeSelect($form, $defaults, $this->t('core'));
    $this->setActions($form);

    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $types = array_filter($form_state->getValue('types'));

    $this->configFactory->getEditable('config_packager.assignment')->set('core.types', $types)->save();

    $form_state->setRedirect('config_packager.assignment');
    drupal_set_message($this->t('Package assignment configuration saved.'));
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc