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