Skip to content
Snippets Groups Projects
Verified Commit 49e0f8b6 authored by Dave Long's avatar Dave Long
Browse files

Issue #2653652 by vasike, tstoeckler, penyaskito, Daniel_Rempe, catch, Gábor...

Issue #2653652 by vasike, tstoeckler, penyaskito, Daniel_Rempe, catch, Gábor Hojtsy, smustgrave, maxocub, alexpott, Kristen Pol: Create an interface for ConfigEntityMapper
parent c61764be
Branches
Tags
43 merge requests!54479.5.x SF update,!5014Issue #3071143: Table Render Array Example Is Incorrect,!4868Issue #1428520: Improve menu parent link selection,!4594Applying patch for Views Global Text area field to allow extra HTML tags. As video, source and iframe tag is not rendering. Due to which Media embedded video and remote-video not rendering in Views Global Text area field.,!3878Removed unused condition head title for views,!38582585169-10.1.x,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3668Resolve #3347842 "Deprecate the trusted",!3651Issue #3347736: Create new SDC component for Olivero (header-search),!3546refactored dialog.pcss file,!3531Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!3502Issue #3335308: Confusing behavior with FormState::setFormState and FormState::setMethod,!3452Issue #3332701: Refactor Claro's tablesort-indicator stylesheet,!3451Issue #2410579: Allows setting the current language programmatically.,!3355Issue #3209129: Scrolling problems when adding a block via layout builder,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3147Issue #3328457: Replace most substr($a, $i) where $i is negative with str_ends_with(),!3146Issue #3328456: Replace substr($a, 0, $i) with str_starts_with(),!3133core/modules/system/css/components/hidden.module.css,!31312878513-10.1.x,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2614Issue #2981326: Replace non-test usages of \Drupal::logger() with IoC injection,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1591Issue #3199697: Add JSON:API Translation experimental module,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!844Resolve #3036010 "Updaters",!673Issue #3214208: FinishResponseSubscriber could create duplicate headers,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
......@@ -19,7 +19,7 @@
/**
* Configuration mapper for configuration entities.
*/
class ConfigEntityMapper extends ConfigNamesMapper {
class ConfigEntityMapper extends ConfigNamesMapper implements ConfigEntityMapperInterface {
/**
* The entity type manager.
......@@ -115,29 +115,14 @@ public function populateFromRouteMatch(RouteMatchInterface $route_match) {
}
/**
* Gets the entity instance for this mapper.
*
* @return \Drupal\Core\Config\Entity\ConfigEntityInterface
* The configuration entity.
* {@inheritdoc}
*/
public function getEntity() {
return $this->entity;
}
/**
* Sets the entity instance for this mapper.
*
* This method can only be invoked when the concrete entity is known, that is
* in a request for an entity translation path. After this method is called,
* the mapper is fully populated with the proper display title and
* configuration names to use to check permissions or display a translation
* screen.
*
* @param \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
* The configuration entity to set.
*
* @return bool
* TRUE, if the entity was set successfully; FALSE otherwise.
* {@inheritdoc}
*/
public function setEntity(ConfigEntityInterface $entity) {
if (isset($this->entity)) {
......@@ -173,34 +158,20 @@ public function getBaseRouteParameters() {
}
/**
* Set entity type for this mapper.
*
* This should be set in initialization. A mapper that knows its type but
* not yet its names is still useful for router item and tab generation. The
* concrete entity only turns out later with actual controller invocations,
* when the setEntity() method is invoked before the rest of the methods are
* used.
*
* @param string $entity_type
* The entity type to set.
*
* @return bool
* TRUE if the entity type was set correctly; FALSE otherwise.
* {@inheritdoc}
*/
public function setType($entity_type) {
public function setType(string $entity_type_id): bool {
if (isset($this->entityType)) {
return FALSE;
}
$this->entityType = $entity_type;
$this->entityType = $entity_type_id;
return TRUE;
}
/**
* Gets the entity type from this mapper.
*
* @return string
* {@inheritdoc}
*/
public function getType() {
public function getType(): string {
return $this->entityType;
}
......
<?php
namespace Drupal\config_translation;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
/**
* Defines an interface for configuration entity mappers.
*/
interface ConfigEntityMapperInterface extends ConfigMapperInterface {
/**
* Gets the entity instance for this mapper.
*
* @return \Drupal\Core\Config\Entity\ConfigEntityInterface
* The configuration entity.
*/
public function getEntity();
/**
* Sets the entity instance for this mapper.
*
* This method can only be invoked when the concrete entity is known, that is
* in a request for an entity translation path. After this method is called,
* the mapper is fully populated with the proper display title and
* configuration names to use to check permissions or display a translation
* screen.
*
* @param \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
* The configuration entity to set.
*
* @return bool
* TRUE, if the entity was set successfully; FALSE otherwise.
*/
public function setEntity(ConfigEntityInterface $entity);
/**
* Set entity type for this mapper.
*
* This should be set in initialization. A mapper that knows its type but
* not yet its names is still useful for router item and tab generation. The
* concrete entity only turns out later with actual controller invocations,
* when the setEntity() method is invoked before the rest of the methods are
* used.
*
* @param string $entity_type_id
* The entity type ID to set.
*
* @return bool
* TRUE if the entity type ID was set correctly; FALSE otherwise.
*/
public function setType(string $entity_type_id): bool;
/**
* Gets the entity type ID from this mapper.
*
* @return string
* The entity type ID.
*/
public function getType(): string;
}
......@@ -2,7 +2,7 @@
namespace Drupal\editor\EventSubscriber;
use Drupal\config_translation\ConfigEntityMapper;
use Drupal\config_translation\ConfigEntityMapperInterface;
use Drupal\config_translation\Event\ConfigMapperPopulateEvent;
use Drupal\config_translation\Event\ConfigTranslationEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
......@@ -49,7 +49,7 @@ public static function getSubscribedEvents(): array {
*/
public function addConfigNames(ConfigMapperPopulateEvent $event) {
$mapper = $event->getMapper();
if ($mapper instanceof ConfigEntityMapper && $mapper->getType() == 'filter_format') {
if ($mapper instanceof ConfigEntityMapperInterface && $mapper->getType() == 'filter_format') {
$editor_config_name = 'editor.editor.' . $mapper->getEntity()->id();
// Only add the text editor config if it exists, otherwise we assume no
// editor has been set for this text format.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment