Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-31647: more flexibility added to AttributeMapper::supports #152

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/Configuration/UI/Mapper/CustomTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private function getAttributeTypeMapper(

foreach ($this->customTagAttributeMappers as $attributeMapper) {
// get first supporting, order of these mappers is controlled by 'priority' DI tag attribute
if ($attributeMapper->supports($attributeType)) {
if ($attributeMapper->supports($tagName, $attributeName, $attributeType)) {
return $this->supportedTagAttributeMappersCache[$attributeType] = $attributeMapper;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ interface AttributeMapper
/**
* Check if mapper supports given Custom Tag attribute type.
*
* @param string $tagName
* @param string $attributeName
* @param string $attributeType
*
* @return bool
*/
public function supports(string $attributeType): bool;
public function supports(string $tagName, string $attributeName, string $attributeType): bool;

/**
* Map Configuration for the given Custom Tag attribute type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
final class ChoiceAttributeMapper extends CommonAttributeMapper implements AttributeMapper
{
public function supports(string $attributeType): bool
public function supports(string $tagName, string $attributeName, string $attributeType): bool
{
return 'choice' === $attributeType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CommonAttributeMapper implements AttributeMapper
/**
* {@inheritdoc}
*/
public function supports(string $attributeType): bool
public function supports(string $tagName, string $attributeName, string $attributeType): bool
{
return true;
}
Expand Down