I am trying to move 2 form fields to the advanced sidebar: dismissible and status. Status was already part of the meta container and setting #group='meta' on dismissable also placed it there; but these weren't in the proper order. Nothing I do seems to have any impact on:
- dismissible
- standard meta fields: published, author, revision log
- status
Both dismissible and status are fields added by the Sitewide Alert module which defines the entity which this is the edit form for.
I gave up trying to move my 2 fields (together) so I created my own details block as:
$form['alert_settings'] = [
'#type' => 'details',
'#group' => 'advanced',
'#weight' => -99,
'#title' => t('Alert settings'),
'#tree' => TRUE,
'#access' => TRUE,
'#open' => TRUE,
];
and then assigned both fields #group='alert_settings'. This works fine as it creates a new details group which is placed at the top of the right sidebar. Perfect, except I want status to be the top item in this block, followed by dismissible.
No matter which of the status #weight options I set (or dismissable ones); I can't change the order of these.
I have tried:
$form['status']['#weight'] = -99;
$form['status']['widget']['#weight'] = -99;
$form['status']['widget']['value']['#weight'] = -99;
What am I missing here?