function brainstorm_theme_form_comment_form_alter in Brainstorm profile 8
Same name and namespace in other branches
- 7 themes/brainstorm_theme/template.php \brainstorm_theme_form_comment_form_alter()
Implements hook_form_FORM_ID_alter() for comment_form().
File
- theme/
brainstorm_theme/ brainstorm_theme.theme, line 194 - Process theme data.
Code
function brainstorm_theme_form_comment_form_alter(&$form, $form_state, $form_id) {
$user = \Drupal::currentUser();
$form['author']['_author']['#type'] = 'hidden';
$form['author']['name'] = array(
'#weight' => -1,
'#type' => 'textfield',
'#default_value' => $user
->id() != 0 ? $user
->getAccountName() : '',
'#attributes' => array(
'placeholder' => t('Your full name'),
),
'#required' => TRUE,
'#disabled' => $user
->id() != 0 ? TRUE : FALSE,
);
$form['author']['mail'] = array(
'#type' => 'textfield',
'#default_value' => $user
->id() != 0 ? $user
->getEmail() : '',
'#attributes' => array(
'placeholder' => t('E-mail address'),
),
'#required' => TRUE,
'#disabled' => $user
->id() != 0 ? TRUE : FALSE,
);
$form['author']['#weight'] = 0;
$form['field_comment_blog_body']['#weight'] = -1;
$form['field_comment_blog_body']['widget'][0]['value']['#title'] = '';
$form['field_comment_blog_body']['widget'][0]['value']['#placeholder'] = t('Write your comment here...');
$form['actions']['submit']['#value'] = t('Submit');
}