| Code Coverage | ||||||||||
| Classes and Traits | Functions and Methods | Lines | ||||||||
| Total |  | 0.00% | 0 / 1 |  | 75.00% | 3 / 4 | CRAP |  | 84.62% | 11 / 13 | 
| ConfigFormBase |  | 0.00% | 0 / 1 |  | 75.00% | 3 / 4 | 4.06 |  | 84.62% | 11 / 13 | 
| __construct |  | 100.00% | 1 / 1 | 1 |  | 100.00% | 2 / 2 | |||
| create |  | 0.00% | 0 / 1 | 2 |  | 0.00% | 0 / 2 | |||
| buildForm |  | 100.00% | 1 / 1 | 1 |  | 100.00% | 7 / 7 | |||
| submitForm |  | 100.00% | 1 / 1 | 1 |  | 100.00% | 2 / 2 | |||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\Core\Form\ConfigFormBase. | |
| */ | |
| namespace Drupal\Core\Form; | |
| use Drupal\Core\Config\ConfigFactoryInterface; | |
| use Symfony\Component\DependencyInjection\ContainerInterface; | |
| /** | |
| * Base class for implementing system configuration forms. | |
| */ | |
| abstract class ConfigFormBase extends FormBase { | |
| use ConfigFormBaseTrait; | |
| /** | |
| * Constructs a \Drupal\system\ConfigFormBase object. | |
| * | |
| * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory | |
| * The factory for configuration objects. | |
| */ | |
| public function __construct(ConfigFactoryInterface $config_factory) { | |
| $this->setConfigFactory($config_factory); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public static function create(ContainerInterface $container) { | |
| return new static( | |
| $container->get('config.factory') | |
| ); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function buildForm(array $form, FormStateInterface $form_state) { | |
| $form['actions']['#type'] = 'actions'; | |
| $form['actions']['submit'] = array( | |
| '#type' => 'submit', | |
| '#value' => $this->t('Save configuration'), | |
| '#button_type' => 'primary', | |
| ); | |
| // By default, render the form using theme_system_config_form(). | |
| $form['#theme'] = 'system_config_form'; | |
| return $form; | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function submitForm(array &$form, FormStateInterface $form_state) { | |
| drupal_set_message($this->t('The configuration options have been saved.')); | |
| } | |
| } |