Commit ac40edf3 authored by Dries's avatar Dries

Issue #1866978 by sun: Leverage new #input facility of #type 'item' for author...

Issue #1866978 by sun: Leverage new #input facility of #type 'item' for author name in comment form.
parent 3e478b03
......@@ -76,30 +76,6 @@ public function form(array $form, array &$form_state, EntityInterface $comment)
}
// Add the author name field depending on the current user.
if ($is_admin) {
$form['author']['name'] = array(
'#type' => 'textfield',
'#title' => t('Authored by'),
'#default_value' => $author,
'#maxlength' => 60,
'#size' => 30,
'#description' => t('Leave blank for %anonymous.', array('%anonymous' => config('user.settings')->get('anonymous'))),
'#autocomplete_path' => 'user/autocomplete',
);
}
elseif ($user->uid) {
$form['author']['_author'] = array(
'#type' => 'item',
'#title' => t('Your name'),
'#markup' => theme('username', array('account' => $user)),
);
$form['author']['name'] = array(
'#type' => 'value',
'#value' => $author,
);
}
else {
$form['author']['name'] = array(
'#type' => 'textfield',
'#title' => t('Your name'),
......@@ -108,6 +84,15 @@ public function form(array $form, array &$form_state, EntityInterface $comment)
'#maxlength' => 60,
'#size' => 30,
);
if ($is_admin) {
$form['author']['name']['#title'] = t('Authored by');
$form['author']['name']['#description'] = t('Leave blank for %anonymous.', array('%anonymous' => config('user.settings')->get('anonymous')));
$form['author']['name']['#autocomplete_path'] = 'user/autocomplete';
}
elseif ($user->uid) {
$form['author']['name']['#type'] = 'item';
$form['author']['name']['#value'] = $form['author']['name']['#default_value'];
$form['author']['name']['#markup'] = theme('username', array('account' => $user));
}
// Add author e-mail and homepage fields depending on the current user.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment