Discrepancy between form ID and entity ID when entity ID contains underscore

Created on 20 August 2021, over 3 years ago
Updated 31 August 2023, over 1 year ago

When I tried to add SGF block via the layout builder, I encountered an error:

Error: Call to a member function getDefaultValue() on null ve funkci Drupal\simple_global_filter\GlobalFilter->get() (Ε™Γ‘dek 66 souboru /app/html/modules/contrib/simple_global_filter/src/GlobalFilter.php) 

The reason is that in SelectGlobalFilter Html::getId($this->getFormId()); return machine name of global filter with hyphen instead of underscore, so $value = \Drupal::entityTypeManager()->getStorage('global_filter')->load($global_filter_id) in \Drupal\simple_global_filter\GlobalFilter::get fails.

Should we just convert hyphens to underscores in ::get or is there a better solution?

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡ΏCzech Republic milos.kroulik

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

    Seems like we need to run this through

    '#type' => 'machine_name', when it's being generated in the first place?
    What do you think, @milos.kroulik ?

Production build 0.71.5 2024