Commit d12aa8ce authored by webchick's avatar webchick

Issue #2131997 by larowlan, wesleydv: Disabling a form field on comments does not work.

parent 9a06e506
......@@ -832,8 +832,8 @@ function comment_form_field_ui_field_instance_edit_form_alter(&$form, $form_stat
* Implements hook_form_FORM_ID_alter().
*/
function comment_form_field_ui_field_overview_form_alter(&$form, $form_state) {
if ($form['#entity_type'] == 'comment') {
$request = \Drupal::request();
$request = \Drupal::request();
if ($form['#entity_type'] == 'comment' && $request->attributes->has('commented_entity_type')) {
$form['#title'] = \Drupal::service('comment.manager')->getFieldUIPageTitle($request->attributes->get('commented_entity_type'), $request->attributes->get('field_name'));
}
}
......@@ -842,8 +842,8 @@ function comment_form_field_ui_field_overview_form_alter(&$form, $form_state) {
* Implements hook_form_FORM_ID_alter().
*/
function comment_form_field_ui_form_display_overview_form_alter(&$form, $form_state) {
if ($form['#entity_type'] == 'comment') {
$request = \Drupal::request();
$request = \Drupal::request();
if ($form['#entity_type'] == 'comment' && $request->attributes->has('commented_entity_type')) {
$form['#title'] = \Drupal::service('comment.manager')->getFieldUIPageTitle($request->attributes->get('commented_entity_type'), $request->attributes->get('field_name'));
}
}
......@@ -852,8 +852,8 @@ function comment_form_field_ui_form_display_overview_form_alter(&$form, $form_st
* Implements hook_form_FORM_ID_alter().
*/
function comment_form_field_ui_display_overview_form_alter(&$form, $form_state) {
if ($form['#entity_type'] == 'comment') {
$request = \Drupal::request();
$request = \Drupal::request();
if ($form['#entity_type'] == 'comment' && $request->attributes->has('commented_entity_type')) {
$form['#title'] = \Drupal::service('comment.manager')->getFieldUIPageTitle($request->attributes->get('commented_entity_type'), $request->attributes->get('field_name'));
}
}
......
......@@ -123,6 +123,12 @@ function testCommentFormat() {
$edit = array('instance[settings][text_processing]' => 0);
$this->drupalPostForm('admin/structure/comments/manage/node__comment/fields/comment.node__comment.comment_body', $edit, t('Save settings'));
// Change formatter settings.
$this->drupalGet('admin/structure/comments/manage/node__comment/display');
$edit = array('fields[comment_body][type]' => 'text_trimmed', 'refresh_rows' => 'comment_body');
$commands = $this->drupalPostAjaxForm(NULL, $edit, array('op' => t('Refresh')));
$this->assertTrue($commands, 'Ajax commands returned');
// Post a comment without an explicit subject.
$this->drupalLogin($this->web_user);
$edit = array('comment_body[0][value]' => $this->randomName(8));
......
......@@ -59,6 +59,7 @@ function setUp() {
'administer content types',
'administer comments',
'administer comment fields',
'administer comment display',
'skip comment approval',
'post comments',
'access comments',
......
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