πŸ‡¨πŸ‡¦Canada @sebish

Account created on 17 July 2010, over 14 years ago
#

Recent comments

πŸ‡¨πŸ‡¦Canada sebish

We were working with colleagues on that issue and we would like to propose an alternative approach. The current patch is adding the description inside the link itself and we do not think it's the best approach.

What about if we use the metadata property already available in the MenuLinkFieldDefinitions.php ?
We could have user.link.menu.yml looking like:

user.page:
  title: 'My account'
  weight: -10
  route_name: user.page
  menu_name: account
  metadata:
    suffix: '(logged in users only)'

Then in the MenuForm.php, we could get the suffix property of metadata. That way, any contrib or custom module could do it the same way to display the message they want beside the menu link.

Something like this in MenuForm.php:

if ( isset($link->getMetaData()['suffix']) ) {
  $suffix = $link->getMetaData()['suffix'];
}

I'd be happy to provide with a patch if you think that's helping.

πŸ‡¨πŸ‡¦Canada sebish

sebish β†’ made their first commit to this issue’s fork.

πŸ‡¨πŸ‡¦Canada sebish

sebish β†’ made their first commit to this issue’s fork.

πŸ‡¨πŸ‡¦Canada sebish

This one is a bit old but since I was working on something similar, I wanted to say we can achieve this using a classic hook_preprocess_views_view.

Example:

function my_module_preprocess_views_view(array &$variables): void {
  $view = $variables['view'];
  if ($view->id() === 'my_view_name' && $view->current_display === 'my_view_display') {
    if (isset($variables['more'])) {
      $variables['more']['#attributes']['class'] = ['read-more', 'standalone-link'];
      $variables['more']['#attributes']['title'] = 'Teaser title text comes here.';
      ...
    }
  }

Ultimately we could provide a way to easily template this with suggestion, since it's not as straightforward in my opinion.
I'm not sure we want to leave this opened or not.

πŸ‡¨πŸ‡¦Canada sebish

It looks like a phpstan-drupal error. As mentionned here. https://github.com/mglaman/phpstan-drupal/issues/559.
We could set $defaultTheme as 'stark' but it would also be deprecated.
Weirdly enough, I can't see that error from upgrade_status. When I run it I get:

================================================================================
Eudonet, --
Scanned on jeu 18/05/2023 - 11:02

No known issues found.

πŸ‡¨πŸ‡¦Canada sebish

Added version 10 core requirement in info as well as other minor fixes to make it Drupal 10 compatible.

πŸ‡¨πŸ‡¦Canada sebish

sebish β†’ made their first commit to this issue’s fork.

Production build 0.71.5 2024