- Issue was unassigned.
- Status changed to Needs review
about 1 year ago 1:25pm 22 November 2023 - last update
about 1 year ago 33 pass - πΊπ¦Ukraine sickness29
Added test and improved previous patch to have default value in element info and example.
- πΊπ¦Ukraine sickness29
Hi @bojanz
Can you please review this? Perhaps we need to update this for 2.0.x?Also it would really help if you would make me a project maintainer so we can move fixes/tests into 2.0.x faster, please let me know
- π·πΈSerbia bojanz
All feature requests are 2.0.x-dev only at this point, we will only commit essential bug fixes to 8.x-1.x.
@sickness29
I am happy to review any and every patch that you provide, but I would like to remain the sole maintainer (along dww) for now. This module has a big install base (100k) and a very wide set of use cases (Commerce, non-Commerce), as well as complex interactions with the underlying library. This makes it very easy to introduce regressions for a large number of sites, so I would rather ensure that each change gets my approval. Since we have less than two pages of issues, this feels doable. With important modules slow development is a feature, not a bug. - Status changed to Fixed
12 months ago 6:57pm 27 December 2023 - π·πΈSerbia bojanz
I've given this issue some thought, and decided not to proceed with it.
The reason why is because we are introducing an Address-specific mechanism to replace a more generic Form API mechanism, namely using #after_build to modify subelements:
public function buildForm(array $form, FormStateInterface $form_state) { $form['address'] = [ '#type' => 'address', '#default_value' => [ 'country_code' => 'US', 'administrative_area' => 'CA', 'locality' => 'Mountain View', 'postal_code' => '94043', 'address_line1' => '1098 Alta Ave', 'organization' => 'Google Inc.', 'given_name' => 'John', 'family_name' => 'Smith', ], '#after_build' => [[get_class($this), 'modifyDescriptions']], ]; $form['submit'] = [ '#type' => 'submit', '#value' => $this->t('Submit'), ]; return $form; } /** * #after_build callback: Modify the address descriptions. */ public static function modifyDescriptions(array $element, FormStateInterface $form_state) { $element['address_line1']['#description'] = 'This is the first address line'; $element['address_line2']['#description'] = 'This is the second address line'; return $element; }
This doesn't feel too verbose, especially taking into account the fact that this is not a majority use case (as evidenced by the few subscribers on this issue). It also allows developers to modify all other properties, such as the #title, #placeholder, #maxlength, #size, etc. I am worried that if we make an exception for field_descriptions, we'll just end up having the same conversation for titles and other settings.
Automatically closed - issue fixed for 2 weeks with no activity.