- Issue created by @alexpott
- @alexpott opened merge request.
- Status changed to Needs review
about 1 year ago 2:05am 3 November 2023 - π¬π§United Kingdom alexpott πͺπΊπ
So we need to decide if we should implement getEditableConfigNames ins ConfigFormBase...
I think we could and then somewhere we could check if there's no map and getEditableConfigNames() returns an empty array we could throw an exception.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
WOW! π€© That looks splendid!
I think we could and then somewhere we could check if there's no map and getEditableConfigNames() returns an empty array we could throw an exception.
+1
And that also opens the door to eventually deprecating and removign
getEditableConfigNames()
I think? π€ - Status changed to RTBC
about 1 year ago 2:38pm 7 November 2023 - πΊπΈUnited States smustgrave
Change makes sense to me, with the empty array return at least.
Tests are all green so nothing noticeably broke.
- π¬π§United Kingdom alexpott πͺπΊπ
Opened π PP-1: Deprecate \Drupal\Core\Form\ConfigFormBase::getEditableConfigNames() - use #config_target instead Postponed to work out how to deprecate getConfigNames() in the ConfigFormBase context.
I thought about implementing ConfigFormBase::getEditableNames() and returning an empty array here and then adding another after build method to check whether there is a map and if there is no map and the return value of ConfigFormBase::getEditableNames() is empty trigger a warning or something. The problem with this is that if you do that you will no longer be told to implement
::getEditableNames()
- so I think we should only do this when we're ready to do π PP-1: Deprecate \Drupal\Core\Form\ConfigFormBase::getEditableConfigNames() - use #config_target instead Postponed and completely deprecate it. - Status changed to Needs review
about 1 year ago 8:36am 8 November 2023 - π¬π§United Kingdom alexpott πͺπΊπ
I realised that the exception being thrown by ::copyFormValuesToConfig() is pointless now that we're calling the method based on what is in the map. So we can remove some dead code.
- Status changed to RTBC
about 1 year ago 8:52am 8 November 2023 - π§πͺBelgium borisson_ Mechelen, π§πͺ
More deleted code is more better, I'm super interested to see how we pick up π PP-1: Deprecate \Drupal\Core\Form\ConfigFormBase::getEditableConfigNames() - use #config_target instead Postponed in the future, but this is already a big win for altering exisiting config forms.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
VERY nice! π€©
This makes
ConfigFormBase
more capable, with a better DX, with less code! π - Status changed to Fixed
about 1 year ago 10:08am 8 November 2023 - π¬π§United Kingdom catch
This is very nice and I never thought we'd be able to remove those custom submits in form alters of config forms or might even make them harder.
Suggested a trait for the empty array implementation of getEditableConfigNames() not because there's any code re-use, but because it'll save copying the same comment around dozens of times and be easier to remove when the time comes.
Committed/pushed to 11.x and cherry-picked to 10.2.x, thanks!
- π¬π§United Kingdom alexpott πͺπΊπ
Updated the CR https://www.drupal.org/node/3373502 β with this.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Alright, we're almost done here!
For the final piece to make
#config_target
a delight to use and usable in also the more refinedConfigFormBase
forms β¦ see π ConfigFormBase + validation constraints: support composite form elements Needs review πThat is ready for final review too now! π₯³
Automatically closed - issue fixed for 2 weeks with no activity.