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

UCPKN-3176: Accessibility statement link in the footer. #1488

Merged
merged 8 commits into from
Aug 23, 2024

Conversation

peterserfozo
Copy link
Contributor

OPENEUROPA-[Insert ticket number here]

Description

The accessibility statement link logic is in the oe_coporate_blocks module from now. See openeuropa/oe_corporate_blocks#155

Change log

  • Added:
  • Changed:
  • Deprecated:
  • Removed:
  • Fixed:
  • Security:

Commands

[Insert commands here]

@peterserfozo peterserfozo force-pushed the contribution/UCPKN-3176 branch from b572a9a to adb2912 Compare August 2, 2024 14:29
drishu
drishu previously approved these changes Aug 13, 2024
@drishu drishu force-pushed the contribution/UCPKN-3176 branch from adb2912 to fa7d00d Compare August 13, 2024 13:25
drishu
drishu previously approved these changes Aug 13, 2024
@drishu drishu force-pushed the contribution/UCPKN-3176 branch 2 times, most recently from c5bc68a to 9ec93bb Compare August 14, 2024 09:27
drishu
drishu previously approved these changes Aug 14, 2024
oe_theme.theme Outdated
Comment on lines 1944 to 1948
if (!function_exists('oe_corporate_blocks_preprocess_set_accessibility_link')) {
return;
}
$cacheability = CacheableMetadata::createFromRenderArray($variables);
$configuration = \Drupal::configFactory()->get(SiteInformation::CONFIG_NAME);
$cacheability->addCacheableDependency($configuration);
/** @var \Drupal\oe_corporate_site_info\SiteInformationInterface $site_information */
$site_information = \Drupal::service('oe_corporate_site_info.site_information');
if (!$site_information->hasAccessibilityLink()) {
$cacheability->applyTo($variables);

oe_corporate_blocks_preprocess_set_accessibility_link($variables);

if (!isset($variables['accessibility_link']) || !$variables['accessibility_link'] instanceof Url) {
return;
}
$uri = $site_information->getAccessibilityLink();
$uri_parts = parse_url($uri);
if ($uri_parts['scheme'] === 'entity') {
[$entity_type_id, $entity_id] = explode('/', $uri_parts['path'], 2);
$entity = \Drupal::entityTypeManager()->getStorage($entity_type_id)->load($entity_id);
if ($entity instanceof NodeInterface) {
$cacheability->addCacheableDependency($entity);
$access = $entity->access('view', \Drupal::currentUser(), TRUE);
$cacheability->addCacheableDependency($access);
if (!$access->isAllowed()) {
$cacheability->applyTo($variables);
// Do not show the button if access to the node is forbidden.
return;
}
}
}
$url = Url::fromUri($uri)->toString();

$variables['accessibility_link'] = $url;
$cacheability->applyTo($variables);
$variables['accessibility_link'] = $variables['accessibility_link']->toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I understand the need of manually calling the preprocess function as it's already set in the two theme implementations.
The accessibility_link variable is already there when I debugged the method, and the toString() method is not needed as far as I can see, because it's called by twig when rendering. I have commented out this method and the links were showing ok for me. The only limitation that we need to be sure to put is a constraint in both oe_theme and oe_corporate_blocks to make sure that previous versions of either components are not used with an older version of the other.
Or, alternatively, we keep the code in this method, leave a todo for the next major, and bail out if the accessibility_link is already there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the function entirely and marked the conflict.

@drishu drishu force-pushed the contribution/UCPKN-3176 branch 2 times, most recently from aa0973d to 67c41ac Compare August 21, 2024 06:56
brummbar
brummbar previously approved these changes Aug 22, 2024
drishu
drishu previously approved these changes Aug 23, 2024
@AaronGilMartinez AaronGilMartinez dismissed stale reviews from drishu and brummbar via 7b7fb7a August 23, 2024 12:51
@AaronGilMartinez AaronGilMartinez force-pushed the contribution/UCPKN-3176 branch from 7b7fb7a to 6981fe6 Compare August 23, 2024 13:32
@AaronGilMartinez AaronGilMartinez merged commit 1ef6222 into 4.x Aug 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants