Skip to content

HelperHooks

Hook implementations for helper.


  • Full name: \Drupal\helper\Hook\HelperHooks

Properties

themeInfo

References to the info of each theme seen by systemInfoAlter().

protected array<string,array> $themeInfo

moduleHandler

protected \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler

moduleExtensionList

protected \Drupal\Core\Extension\ModuleExtensionList $moduleExtensionList

Methods

__construct

Constructs a new HelperHooks object.

public __construct(\Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler, \Drupal\Core\Extension\ModuleExtensionList $moduleExtensionList): mixed

Parameters:

Parameter Type Description
$moduleHandler \Drupal\Core\Extension\ModuleHandlerInterface
$moduleExtensionList \Drupal\Core\Extension\ModuleExtensionList

systemInfoAlter

Implements hook_system_info_alter().

public systemInfoAlter(array& $info, \Drupal\Core\Extension\Extension $file, string $type): void

Parameters:

Parameter Type Description
$info array
$file \Drupal\Core\Extension\Extension
$type string

alterLibraryInfo

Implements hook_library_info_alter().

public alterLibraryInfo(array& $libraries, string $extension): void

Parameters:

Parameter Type Description
$libraries array
$extension string

formAlter

Implements hook_form_alter().

public formAlter(array& $form, \Drupal\Core\Form\FormStateInterface $form_state): void

Parameters:

Parameter Type Description
$form array
$form_state \Drupal\Core\Form\FormStateInterface

fieldWidgetInfoAlter

Implements hook_field_widget_info_alter().

public fieldWidgetInfoAlter(array& $info): void

Parameters:

Parameter Type Description
$info array

See Also:

  • https://www.drupal.org/project/drupal/issues/3344041
  • https://www.drupal.org/project/textarea_widget_for_text

alterFieldWidgetSingleElementForm

Implements hook_field_widget_single_element_form_alter().

public alterFieldWidgetSingleElementForm(array& $element, \Drupal\Core\Form\FormStateInterface $form_state, array $context): void

Hide the "About formats" link from formatted text fields that have only one text format allowed.

Parameters:

Parameter Type Description
$element array
$form_state \Drupal\Core\Form\FormStateInterface
$context array

See Also:

  • https://www.drupal.org/node/3567879
  • https://www.drupal.org/node/3323007
  • https://www.drupal.org/project/allowed_formats

afterBuildRemoveTextFormatHelp

Form element #after_build callback for the field widget.

public static afterBuildRemoveTextFormatHelp(array $element, \Drupal\Core\Form\FormStateInterface $form_state): array

Remove the text format help, which includes the "About formats" link.

  • This method is static. Parameters:
Parameter Type Description
$element array
The widget form element array being built.
$form_state \Drupal\Core\Form\FormStateInterface
The current state of the form.

Return Value:

The modified widget form element array.