Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Unset the filter tips link under comments form in Drupal 8
name: Remove Comment Tips
type: module
description: Remove the comment tips link beneath comment forms in Drupal 8.
core: 8.x
version: '8.x-1.0'
<?php
/**
* Implements hook_form_alter().
*/
function unset_comment_tips_form_comment_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
$form['comment_body']['#after_build'][] = '_unset_comment_tips_configure_comment_form';
}
/**
* Unset the filter tips link underneath the comment form.
*/
function _unset_comment_tips_configure_comment_form(&$form) {
if(isset($form['widget'][0]['format']['help'])) {
unset($form['widget'][0]['format']['help']);
}
return $form;
}
@eugislt

This comment has been minimized.

Show comment Hide comment
@eugislt

eugislt Apr 25, 2018

Drupal 8.5.2 throws:
Warning: Parameter 1 to _ey_core_configure_comment_form() expected to be a reference, value given in Drupal\Core\Form\FormBuilder->doBuildForm() (line 1067)

You have to remove reference from $form in _unset_comment_tips_configure_comment_form function.

But thanks anyway, I've moved this solution to my base module :)

eugislt commented Apr 25, 2018

Drupal 8.5.2 throws:
Warning: Parameter 1 to _ey_core_configure_comment_form() expected to be a reference, value given in Drupal\Core\Form\FormBuilder->doBuildForm() (line 1067)

You have to remove reference from $form in _unset_comment_tips_configure_comment_form function.

But thanks anyway, I've moved this solution to my base module :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment