I have a button that I would like to show to anonymous users only on pages with a path matching en/*.
/* English Button */
{
title: 'English',
path: 'en/home_anon',
options: {
attributes: {
'title': 'English',
'data-icon': 'star',
'class': 'ui-btn-right',
}
},
pages: {
value: ['en/*'],
mode: 'exclude'
},
roles: {
value: ['authenticated user'],
mode: 'exclude',
}
},
Anonymous, en/* path: Appears (* incorrect behavior)
Anonymous, non en/* path: Appears (correct behavior)
Authenticated, en/* path: Does not appear (correct behavior)
Authenticated, non en/* path: Does not appear (correct behavior)
If I remove the roles: exclude authenticated user part, then the exclusion by path works properly. So, it appears that somehow the roles: exclude authenticated user is causing the button to be included even if the path check indicates the button should be excluded.
Comments
Comment #1
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedI believe this is by design, as I based it on how Drupal handles block visibility, but I don't remember for sure. To verify, will you please create a custom Block in Drupal, then set its visibility rules for Pages and for Roles, and see how Drupal reacts to this. I'm fairly certain Drupal only picks one of these settings for the visibility rules.
UPDATE: You can declare a callback function to tweak a block's visibility settings: http://drupalgap.org/node/168#access_callback
Comment #2
ptmkenny CreditAttribution: ptmkenny commentedI'll look into this more, but for now, note that Drupal only allows blocks to be limited by role (there is "include" but no "exclude").
As indicated by this UI text:
So as far as D7 is concerned, there is no "exclude" option.
Comment #3
jomarocas CreditAttribution: jomarocas as a volunteer commentedok i have the same issue, when i put roles and pages,but also i need include this option in my popup options
i try many options but access callback dont work good, any other options for this
i have duplicate popups in user login, one works but when i go to others page that i no specified, fails show me two user login, one works, but the other no make nothing
Comment #4
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedThe access_callback is the way to go for any complex visibility needs. It works better than pages and roles visibility IMO. Please provide more info about the visibility you are looking to accomplish.