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

dawehner’s picture

Wow 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';

Nexotap’s picture

Status: Active » Closed (fixed)

Answered 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

Nexotap’s picture

Issue summary: View changes

Added another question