Verified Commit 1ea295c8 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3383080 by amateescu, srishtiiee, Wim Leers: Provide the 'general'...

Issue #3383080 by amateescu, srishtiiee, Wim Leers: Provide the 'general' category within the plugin manager, and ensure that it remains unaltered
parent d418da39
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -79,6 +79,17 @@ protected function getDiscovery(): YamlDiscovery {
    return $this->discovery;
  }

  /**
   * {@inheritdoc}
   */
  protected function alterDefinitions(&$definitions): void {
    parent::alterDefinitions($definitions);

    if (!isset($definitions[FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY])) {
      throw new \LogicException('Missing fallback category.');
    }
  }

  /**
   * {@inheritdoc}
   */
+2 −4
Original line number Diff line number Diff line
@@ -789,9 +789,7 @@ function comment_entity_view_display_presave(EntityViewDisplayInterface $display
 * Implements hook_field_type_category_info_alter().
 */
function comment_field_type_category_info_alter(&$definitions) {
  // TRICKY: the `comment` field type belongs in the `general` category, so the
  // The `comment` field type belongs in the `general` category, so the
  // libraries need to be attached using an alter hook.
  if (array_key_exists(FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY, $definitions)) {
  $definitions[FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY]['libraries'][] = 'comment/drupal.comment-icon';
}
}
+3 −5
Original line number Diff line number Diff line
@@ -33,9 +33,7 @@ function datetime_range_help($route_name, RouteMatchInterface $route_match) {
 * Implements hook_field_type_category_info_alter().
 */
function datetime_range_field_type_category_info_alter(&$definitions) {
  // TRICKY: the `datetime_range` field type belongs in the `general` category,
  // so the libraries need to be attached using an alter hook.
  if (array_key_exists(FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY, $definitions)) {
  // The `datetime_range` field type belongs in the `general` category, so the
  // libraries need to be attached using an alter hook.
  $definitions[FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY]['libraries'][] = 'datetime_range/drupal.datetime_range-icon';
}
}
+3 −5
Original line number Diff line number Diff line
@@ -71,9 +71,7 @@ function template_preprocess_link_formatter_link_separate(&$variables) {
 * Implements hook_field_type_category_info_alter().
 */
function link_field_type_category_info_alter(&$definitions) {
  // TRICKY: the `link` field type belongs in the `general` category, so the
  // libraries need to be attached using an alter hook.
  if (array_key_exists(FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY, $definitions)) {
  // The `link` field type belongs in the `general` category, so the libraries
  // need to be attached using an alter hook.
  $definitions[FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY]['libraries'][] = 'link/drupal.link-icon';
}
}
+3 −5
Original line number Diff line number Diff line
@@ -537,9 +537,7 @@ function media_views_query_substitutions(ViewExecutable $view) {
 * Implements hook_field_type_category_info_alter().
 */
function media_field_type_category_info_alter(&$definitions) {
  // TRICKY: the `media` field type belongs in the `general` category, so the
  // libraries need to be attached using an alter hook.
  if (array_key_exists(FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY, $definitions)) {
  // The `media` field type belongs in the `general` category, so the libraries
  // need to be attached using an alter hook.
  $definitions[FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY]['libraries'][] = 'media/drupal.media-icon';
}
}
Loading