Unset the filter tips link under comments form in Drupal 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 :)