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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
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 :)