$other['options_source'] = array(
      '#title' => t('Load a pre-built option list'),
      '#type' => 'select',
      '#options' => $options,
      '#default_value' => $component['extra']['options_source'],
      '#weight' => 1,
      '#description' => t('Use a pre-built list of options rather than entering options manually. Options will not be editable if using pre-built list.'),
      '#parents' => array('extra', 'options_source'),
      '#weight' => 5,
    );

The #weight is there twice.

CommentFileSizeAuthor
#6 2612428-6.patch589 bytesjoshi.rohit100
#2 2612428-2.patch479 bytesjoshi.rohit100

Comments

joachim created an issue. See original summary.

joshi.rohit100’s picture

Status: Active » Needs review
StatusFileSize
new479 bytes
joachim’s picture

Status: Needs review » Needs work

Thanks for the patch!

However, I'm not sure that's the right one to remove. IIRC that when an array key is repeated, PHP takes the later value, so removing the 5 weight would change the behaviour here. I could be wrong though -- needs checking.

danchadwick’s picture

Category: Bug report » Task

I agree with #3. Needs testing.

joachim’s picture

Yup, the later value wins:

$ php -r '$a = ["foo" => 1, "bar" => 2, "foo" => 3]; print_r($a);'
Array
(
    [foo] => 3
    [bar] => 2
)

So the earlier value should be removed to preserve the current behaviour.

joshi.rohit100’s picture

Status: Needs work » Needs review
StatusFileSize
new589 bytes
joachim’s picture

Status: Needs review » Reviewed & tested by the community

That's great. Thanks!

  • DanChadwick committed 967ccae on 7.x-4.x
    Issue #2612428 by joshi.rohit100: Fixed benign duplicated weight...
danchadwick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x-4.x.

danchadwick’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Status: Fixed » Patch (to be ported)
fenstrat’s picture

Status: Patch (to be ported) » Closed (outdated)

Closing to clear out the old Webform 8.x-4.x branch. See #2827845: [roadmap] YAML Form 8.x-1.x to Webform 8.x-5.x.

fenstrat’s picture

Status: Closed (outdated) » Fixed
fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev

  • DanChadwick committed 967ccae on 8.x-5.x
    Issue #2612428 by joshi.rohit100: Fixed benign duplicated weight...

Status: Fixed » Closed (fixed)

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