Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.0-rc3
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
25 Nov 2011 at 00:12 UTC
Updated:
25 Nov 2011 at 10:14 UTC
While fiddling around with a custom access plugin I found something that makes me confuse.
Basically I took views_plugin_access_perm as a template.
There's a get_access_callback() and access($account) function.
The first one gets embedded in the menu, which is clear to me. But what about the second function?
Where and/or when does it get called? For testing purpose I put in a exit;. Cleared cache, rebuild menus but it never stops.
Can you please enlighten me?
And maybe you also cann tell me, why get_access_callback() has to retunr an array?
~Nexo
Comments
Comment #1
dawehnerWow a question about the api of views, that's exciting!
access() is used on every display type beside page displays, for example block. There you have the full view object available.
As you probably know menu callbacks have an access callback in drupal by default (so do page displays). This access happens by the menu callback.
By default the menu api provides access callback and access arguments, to be as flexible as possible. So get_access_callback() supports this as well.
Did this answer your question?
access() is maybe not called for you because you are either user1 or have the permission 'access all views';
Comment #2
Nexotap commentedAnswered the question and I'm completely happy. Seems I'm getting closer to the big picture ;)
Also tracked down where from the get_acces_callback() gets called and saw, why the return value has to be an array.
Thank you!
~Nexo
Comment #2.0
Nexotap commentedAdded another question