Hi Tyler.

I have block, I use wildcards "*" set the visibility on all node pages. And I want the block not show up on user login, user logout, register page.
how to do this?

Comments

tyler.frankenstein’s picture

Category: Task » Support request
Status: Active » Needs review

Try this in settings.js:

my_custom_block: {

  /* ... other block settings ... */

  pages: {
    value: ['user/login', 'user/register', 'user/logout'],
    mode: 'exclude'
  },

    /* ... other block settings ... */

}
huythuytq’s picture

This is my code in settings.js:

my_custom_block:{
       pages: {
       value: ['user/login', 'user/register', 'user/logout'],
       mode: 'exclude'
      },
        pages:{
        value:['node/*'],
        mode:'include',
      },
    }

this part of code doesn't work

pages: {
          value: ['user/login', 'user/register', 'user/logout'],
          mode: 'exclude'
         }
tyler.frankenstein’s picture

Category: Support request » Task
Status: Needs review » Needs work

Just like Drupal core (as far as I know), DrupalGap only supports one set of rules for pages, and you can either include or exclude a block's visibility.

admin/structure/block/manage/user/login/configure

However, I'm open to the idea of expanding (or intercepting) drupalgap_check_visibility() to allow a custom function be called, for example maybe we could do something like this:

pages: {
  value: function(type, data) {
    // Figure out my custom visiblity...
    return true; // or false;
  },
  mode: 'function'
}

drupalgap_check_visibility() would need to be expanded or intercepted to support this.

huythuytq’s picture

thanks you for answer.

tyler.frankenstein’s picture

Status: Needs work » Closed (fixed)

It's now (and has been for a while) possible to have a callback function determine the access on a block: http://docs.drupalgap.org/7/Blocks/Block_Visibility_Rules