When creating a child class of the MenuSection class, overriding the $component property is not sufficient to change the component attribute in the JSON payload, as the jsonSerialize method has it hard-coded.
From MenuSection:
/**
* Prepare the menu for JSON serialization.
*
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
/* ... */
return [
/* ... */
'component' => 'menu-section',
/* ... */
];
}
The code should be using $this->component instead:
Description:
When creating a child class of the
MenuSection
class, overriding the$component
property is not sufficient to change thecomponent
attribute in the JSON payload, as thejsonSerialize
method has it hard-coded.From
MenuSection
:The code should be using
$this->component
instead: