function socialbase_form_node_form_alter in Open Social 8
Same name and namespace in other branches
- 8.9 themes/socialbase/includes/form.inc \socialbase_form_node_form_alter()
- 8.2 themes/socialbase/includes/form.inc \socialbase_form_node_form_alter()
- 8.3 themes/socialbase/includes/form.inc \socialbase_form_node_form_alter()
- 8.4 themes/socialbase/includes/form.inc \socialbase_form_node_form_alter()
- 8.5 themes/socialbase/includes/form.inc \socialbase_form_node_form_alter()
- 8.6 themes/socialbase/includes/form.inc \socialbase_form_node_form_alter()
- 8.7 themes/socialbase/includes/form.inc \socialbase_form_node_form_alter()
- 8.8 themes/socialbase/includes/form.inc \socialbase_form_node_form_alter()
Implements hook_form_BASE_ID_alter().
Set button types for input elements. Note that these variables are read in hook_preprocess_input.
File
- themes/
socialbase/ includes/ form.inc, line 392 - The form inc file for the Social base theme.
Code
function socialbase_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$form['#attributes']['class'][] = 'form--default';
// Delete is not an input element, so we must apply extra classes
// to anchor directly.
if (isset($form['actions']['delete'])) {
$form['actions']['delete']['#attributes']['class'][] = 'btn btn-flat';
}
if (isset($form['actions']['preview'])) {
$form['actions']['preview']['#button_type'] = 'flat';
}
if (isset($form['actions']['submit'])) {
$form['actions']['submit']['#button_level'] = 'raised';
$form['actions']['submit']['#button_type'] = 'primary';
}
if (isset($form['actions']['publish'])) {
$form['actions']['publish']['#button_level'] = 'raised';
$form['actions']['publish']['#button_type'] = 'primary';
}
if (isset($form['actions']['unpublish'])) {
$form['actions']['unpublish']['#button_level'] = 'raised';
$form['actions']['unpublish']['#button_type'] = 'primary';
}
}