Project specification requires feature "Promote to homepage" be disabled by default. So I managed to solve it with the snippet below, but I feel like probably there is a cleaner more POO way to achieve this.
¿How can I achieve the same result without modifying a nested array key?
// Disable promote by default
function website_form_node_form_alter(&$form, FormState $form_state, $form_id)
{
switch ($form_id) {
case 'node_article_form':
if (array_key_exists('promote', $form)) {
$form['promote']['widget']['value']['#default_value'] = false;
}
break;
}
}
