Comments

KarenS created an issue. See original summary.

karens’s picture

Status: Active » Needs review
StatusFileSize
new2.26 KB

Here's a patch.

mherchel’s picture

Status: Needs review » Needs work
StatusFileSize
new838 bytes
new2.27 KB

This is awesome. There were a few bugs (fixed them w @hawkeye.twolf's help). But there are more (see error below).

Current status attached.

( ! ) Fatal error: Declaration of Drupal\quicklink\Form\QuicklinkConfigForm::create(Drupal\quicklink\Form\ContainerInterface $container) must be compatible with Drupal\Core\Form\ConfigFormBase::create(Symfony\Component\DependencyInjection\ContainerInterface $container) in /Users/mherchel/sites/quicklink/src/Form/QuicklinkConfigForm.php on line 13
m4olivei’s picture

Seems like that PHP error is from the following:

+++ b/src/Form/QuicklinkConfigForm.php
@@ -4,12 +4,44 @@ namespace Drupal\quicklink\Form;
+  public static function create(ContainerInterface $container) {

You need to add a use statement along with the others at the top of this class to let PHP know where to find the right ContainerInterface interface, eg. use Symfony\Component\DependencyInjection\ContainerInterface;

i-trokhanenko’s picture

StatusFileSize
new2.42 KB

Please review!

i-trokhanenko’s picture

Status: Needs work » Needs review
mherchel’s picture

@i-trokhanenko Thanks for this! I'll test this and review it by early next week.

mtift’s picture

Status: Needs review » Needs work

When extending ConfigFormBase it's not necessary to inject ConfigFactoryInterface. You can just do

$config = $this->config('your_module.settings');

In this patch, it doesn't look like it's even using configuration.

marcoscano’s picture

This looks good to me, with the minor comment below:

+++ b/src/Form/QuicklinkConfigForm.php
@@ -11,6 +14,36 @@ use Drupal\Core\Form\FormStateInterface;
+   * Constructs a \Drupal\system\ConfigFormBase object.

Nitpick: We could update this line to be accurate to the object we are creating here.

When extending ConfigFormBase it's not necessary to inject ConfigFactoryInterface

True, however this patch overrides the constructor, and in order to be able to call the parent's contructor, we need the config factory available, so I guess it's OK as it stands, on this regard.

mtift’s picture

Good point @marcoscano. I concur.

mherchel’s picture

Status: Needs work » Needs review
StatusFileSize
new2.31 KB
new530 bytes

OK. Updated patches below based on comments from @marcoscano and a quick hangout w @mtift

marcoscano’s picture

Status: Needs review » Reviewed & tested by the community

👍 Looks good to me!

mherchel’s picture

Status: Reviewed & tested by the community » Fixed

Woot! Committed. Thanks everyone :)

Status: Fixed » Closed (fixed)

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