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

Access callback before rendering the element #1013

Open
majuril opened this issue Feb 6, 2018 · 2 comments
Open

Access callback before rendering the element #1013

majuril opened this issue Feb 6, 2018 · 2 comments

Comments

@majuril
Copy link

majuril commented Feb 6, 2018

I have a custom access callback function based on the user's permissions.
Everything is basically working and user can't see the content inside the element if there are no sufficient permissions... Although the block container is still rendered.

So for example if my footer region doesn't contain anything else than this custom block (with custom permissions), the footer region is still rendered even though there is nothing inside it. I ran in to this same issue with the popup-menus, icon is still rendered even though user can't open the popup-menu.

Is there a way to handle the access callback before DG renders anything on screen?

@signalpoint
Copy link
Owner

@majuril I think the way regions is rendered in DrupalGap core would need to be updated to be a little more intelligent. As you suggested, if there are no blocks to be rendered in that region, then the region shouldn't be rendered at all.

The code that powers the rendering of the regions starts around here: https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/includes/region.inc.js#L31

The workaround (without having to improve/hack DG core) would probably be to attach a pageshow handler to your page(s), and in that handler make a decision about whether or not you'd like to remove that region.

@majuril
Copy link
Author

majuril commented Feb 6, 2018

Cheers! Good to know I wasn't doing anything "wrong", that caused this issue.

For this case I actually decided to solve it with some CSS. By default the footer is now transparent and when something is printed on it, it'll be printed inside ".footer-container" which is set to have width: 100% and other required CSS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants