Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
ui_patterns-3395960
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
ui_patterns-3395960
Merge requests
!3
Resolve
#3395960
"2.0.x add new"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve
#3395960
"2.0.x add new"
3395960-2.0.x-add-new
into
2.0.x
Overview
0
Commits
104
Pipelines
0
Changes
24
Merged
Thomas MUSA
requested to merge
3395960-2.0.x-add-new
into
2.0.x
1 year ago
Overview
0
Commits
104
Pipelines
0
Changes
24
Expand
Closes
#3395960
0
0
Merge request reports
Compare
2.0.x
2.0.x (base)
and
latest version
latest version
0da2f927
104 commits,
1 year ago
24 files
+
2685
−
57
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
24
Search (e.g. *.vue) (Ctrl+P)
modules/ui_patterns_field_formatters/src/EventSubscriber/UiPatternsFieldFormattersEntitySchemaSubscriber.php
0 → 100644
+
61
−
0
Options
<?php
namespace
Drupal\ui_patterns_field_formatters\EventSubscriber
;
use
Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface
;
use
Drupal\Core\Entity\EntityTypeEvent
;
use
Drupal\Core\Entity\EntityTypeEventSubscriberTrait
;
use
Drupal\Core\Entity\EntityTypeListenerInterface
;
use
Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait
;
use
Symfony\Component\EventDispatcher\EventSubscriberInterface
;
/**
* Class UiPatternsFieldFormattersEntitySchemaSubscriber.
*
* allow to do things when the entity types change. For example, rebuild the
* source plugin definitions
*
* @SuppressWarnings(PHPMD.CamelCaseParameterName)
* @SuppressWarnings(PHPMD.CamelCaseVariableName)
* @SuppressWarnings(PHPMD.LongClassName)
* @SuppressWarnings(PHPMD.LongVariable)
*/
class
UiPatternsFieldFormattersEntitySchemaSubscriber
implements
EntityTypeListenerInterface
,
EventSubscriberInterface
{
use
EntityTypeEventSubscriberTrait
;
use
FieldStorageDefinitionEventSubscriberTrait
;
/**
* The ui_patterns source plugin manager
*
* @var \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface
*/
protected
CachedDiscoveryInterface
$uiPatternsSourcePluginManager
;
/**
* Constructs a ViewsEntitySchemaSubscriber.
*
* @param \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface $ui_patterns_source_plugin_manager
* The entity type manager.
*/
public
function
__construct
(
CachedDiscoveryInterface
$ui_patterns_source_plugin_manager
)
{
$this
->
uiPatternsSourcePluginManager
=
$ui_patterns_source_plugin_manager
;
}
/**
* {@inheritdoc}
*/
public
static
function
getSubscribedEvents
():
array
{
return
array_merge
(
static
::
getEntityTypeEvents
(),
static
::
getFieldStorageDefinitionEvents
());
}
/**
* {@inheritdoc}
*/
public
function
onEntityTypeEvent
(
EntityTypeEvent
$event
,
$event_name
)
{
$this
->
uiPatternsSourcePluginManager
->
clearCachedDefinitions
();
}
}
Loading