Skip to content
Snippets Groups Projects
Commit e73727fe authored by ekes's avatar ekes Committed by dpi
Browse files

Issue #3498936 by acbramley, ekes, dpi: Add cross core compatibility for views metadata.

parent 6a60bcbf
No related branches found
No related tags found
Loading
Pipeline #421884 passed with warnings
...@@ -6,6 +6,7 @@ include: ...@@ -6,6 +6,7 @@ include:
- '/includes/include.drupalci.workflows.yml' - '/includes/include.drupalci.workflows.yml'
variables: variables:
OPT_IN_TEST_PREVIOUS_MINOR: '1'
OPT_IN_TEST_NEXT_MAJOR: '1' OPT_IN_TEST_NEXT_MAJOR: '1'
OPT_IN_TEST_NEXT_MINOR: '1' OPT_IN_TEST_NEXT_MINOR: '1'
SKIP_ESLINT: '1' SKIP_ESLINT: '1'
...@@ -15,3 +16,7 @@ variables: ...@@ -15,3 +16,7 @@ variables:
phpunit: phpunit:
variables: variables:
SYMFONY_DEPRECATIONS_HELPER: "ignoreFile=./.local-deprecation-ignore.txt" SYMFONY_DEPRECATIONS_HELPER: "ignoreFile=./.local-deprecation-ignore.txt"
composer (previous minor):
variables:
PHP_VERSION: '8.3'
...@@ -19,6 +19,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; ...@@ -19,6 +19,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\TypedData\TypedDataManagerInterface; use Drupal\Core\TypedData\TypedDataManagerInterface;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem; use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface; use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface;
use Drupal\datetime_range\Hook\DatetimeRangeViewsHooks;
use Drupal\field\FieldStorageConfigInterface; use Drupal\field\FieldStorageConfigInterface;
use Drupal\views\Views; use Drupal\views\Views;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -43,6 +44,8 @@ class DateRecurViewsHooks implements ContainerInjectionInterface { ...@@ -43,6 +44,8 @@ class DateRecurViewsHooks implements ContainerInjectionInterface {
* The entity field manager. * The entity field manager.
* @param \Drupal\Core\TypedData\TypedDataManagerInterface $typedDataManager * @param \Drupal\Core\TypedData\TypedDataManagerInterface $typedDataManager
* The typed data manager. * The typed data manager.
* @param \Drupal\datetime_range\Hook\DatetimeRangeViewsHooks|null $datetimeRangeViewsHooks
* The views hooks class for datetime_range.
*/ */
public function __construct( public function __construct(
protected Connection $database, protected Connection $database,
...@@ -50,6 +53,7 @@ class DateRecurViewsHooks implements ContainerInjectionInterface { ...@@ -50,6 +53,7 @@ class DateRecurViewsHooks implements ContainerInjectionInterface {
protected EntityTypeManagerInterface $entityTypeManager, protected EntityTypeManagerInterface $entityTypeManager,
protected EntityFieldManagerInterface $entityFieldManager, protected EntityFieldManagerInterface $entityFieldManager,
protected TypedDataManagerInterface $typedDataManager, protected TypedDataManagerInterface $typedDataManager,
protected ?DatetimeRangeViewsHooks $datetimeRangeViewsHooks
) { ) {
} }
...@@ -63,6 +67,7 @@ class DateRecurViewsHooks implements ContainerInjectionInterface { ...@@ -63,6 +67,7 @@ class DateRecurViewsHooks implements ContainerInjectionInterface {
$container->get('entity_type.manager'), $container->get('entity_type.manager'),
$container->get('entity_field.manager'), $container->get('entity_field.manager'),
$container->get('typed_data_manager'), $container->get('typed_data_manager'),
$container->get(DatetimeRangeViewsHooks::class, ContainerInterface::NULL_ON_INVALID_REFERENCE),
); );
} }
...@@ -376,7 +381,7 @@ class DateRecurViewsHooks implements ContainerInjectionInterface { ...@@ -376,7 +381,7 @@ class DateRecurViewsHooks implements ContainerInjectionInterface {
*/ */
protected function getParentFieldViewsData(FieldStorageConfigInterface $fieldDefinition): array { protected function getParentFieldViewsData(FieldStorageConfigInterface $fieldDefinition): array {
$this->moduleHandler->loadInclude('datetime_range', 'inc', 'datetime_range.views'); $this->moduleHandler->loadInclude('datetime_range', 'inc', 'datetime_range.views');
return \datetime_range_field_views_data($fieldDefinition); return $this->datetimeRangeViewsHooks?->fieldViewsData($fieldDefinition) ?? \datetime_range_field_views_data($fieldDefinition);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment