Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ACF’s picture

Status: Active » Needs review
FileSize
12.76 KB
ACF’s picture

Fixing indentation.

ACF’s picture

Update to use form controller in router.

amateescu’s picture

Status: Needs review » Needs work
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestFormBase.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\search\Form\SearchFormBase.
+ */
+
+namespace Drupal\simpletest\Form;
+
+use Drupal\system\SystemConfigFormBase;
+use Drupal\Core\Config\ConfigFactory;
+use Drupal\Core\ControllerInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Provides a generic simpletest form class.
+ */
+abstract class SimpletestFormBase extends SystemConfigFormBase implements ControllerInterface {
+
+  /**
+   * Stores the configuration factory.
+   *
+   * @var \Drupal\Core\Config\ConfigFactory
+   */
+  protected $configFactory;
+
+  /**
+   * Constructs a \Drupal\language\Form\SimpletestFormBase object.
+   *
+   * @param \Drupal\Core\Config\ConfigFactory $config_factory
+   *   The factory for configuration objects.
+   */
+  public function __construct(ConfigFactory $config_factory) {
+    $this->configFactory = $config_factory;
+  }
+
+  /**
+   * Implements \Drupal\Core\ControllerInterface::create().
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('config.factory')
+    );
+  }
+

This is already handled in SystemConfigFormBase.

ACF’s picture

Status: Needs work » Needs review
FileSize
11.48 KB

Thanks for the review, another attempt.

amateescu’s picture

Status: Needs review » Needs work

Thanks, much better now! Just a couple more things to fix:

+++ b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestSettingsForm.php
@@ -0,0 +1,119 @@
+    $form['general'] = array(
+    '#type' => 'details',
+    '#title' => t('General'),

Wrong indentation here.

+++ b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestSettingsForm.php
@@ -0,0 +1,119 @@
+      $form_state['values']['simpletest_httpauth_password'] = config('simpletest.settings')->get('httpauth.password');

Needs to use $this->configFactory.

ACF’s picture

Status: Needs work » Active
FileSize
1.58 KB
11.53 KB

Made those changes.

ACF’s picture

Status: Active » Needs review
Crell’s picture

Status: Needs review » Needs work
+++ b/core/modules/simpletest/simpletest.module
@@ -47,12 +47,10 @@ function simpletest_menu() {
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('simpletest_settings_form'),
+    'page callback' => 'NOT_USED',

This should now be 'route' => 'simpletest_settings', with no page callback.

ACF’s picture

Status: Needs work » Needs review
FileSize
11.54 KB

Updated with the change.

Crell’s picture

Status: Needs review » Reviewed & tested by the community

Huzzah!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.