You are here

function brainstorm_theme_form_comment_form_alter in Brainstorm profile 7

Same name and namespace in other branches
  1. 8 theme/brainstorm_theme/brainstorm_theme.theme \brainstorm_theme_form_comment_form_alter()

Implements hook_form_FORM_ID_alter() for comment_form().

File

themes/brainstorm_theme/template.php, line 264
Process theme data.

Code

function brainstorm_theme_form_comment_form_alter(&$form, $form_state, $form_id) {
  global $user;
  $form['author']['_author']['#type'] = 'hidden';
  $form['author']['name'] = [
    '#weight' => -1,
    '#type' => 'textfield',
    '#default_value' => $user->uid != 0 ? $user->name : '',
    '#attributes' => [
      'placeholder' => t('Your full name'),
    ],
    '#required' => TRUE,
    '#disabled' => $user->uid != 0 ? TRUE : FALSE,
  ];
  $form['author']['mail'] = [
    '#type' => 'textfield',
    '#default_value' => $user->uid != 0 ? $user->mail : '',
    '#attributes' => [
      'placeholder' => t('E-mail address'),
    ],
    '#required' => TRUE,
    '#disabled' => $user->uid != 0 ? TRUE : FALSE,
  ];
  $form['author']['#weight'] = 0;
  $form['comment_body']['#weight'] = -1;
  $form['comment_body'][LANGUAGE_NONE][0]['value']['#title'] = '';
  $form['comment_body'][LANGUAGE_NONE][0]['value']['#attributes'] = [
    'placeholder' => t('Write your comment here...'),
  ];
  $form['actions']['submit']['#value'] = t('Submit');
}