README.txt 2.85 KB
Newer Older
flaviovs's avatar
flaviovs committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
INTRODUCTION
------------
The Rules block visibility module allows Rules
(https://drupal.org/project/rules) components to be used to control
block visibility. This provides Drupal administrators and developers
extreme flexibility in controling block visibility.


REQUIREMENTS
------------
This module requires the following modules:

 * Rules (https://drupal.org/project/rules)


INSTALLATION
------------
Install as you would normally install a contributed Drupal
module. See:
https://drupal.org/documentation/install/modules-themes/modules-7 for
further information.


CONFIGURATION
-------------
Configuration is done on a per-block basis. To control a block
visibility using a rule component, go to the block settings page,
scroll down to the "Rules" tab, and select the Rules component that
you want to use.

Notice that to be able to be used by this module, a Rules component
*must* be constructed in a very specific way. See the next section for
more information.


CREATING RULES COMPONENTS
-------------------------
To create a Rules component to control block visibility, follow the
steps below:

 1. Go to the add Rules component page in Administration >>
    Configuration >> Workflow >> Rules >> Components >> Add new
    component (admin/config/workflow/rules/components/add)

 2. Select "Action set", "Rule", or "Rule set". Each component type
    limits what can be done using Rules. See
    https://www.drupal.org/node/1582182 for more details about Rules
    components.

 3. After giving a name and optional tags to your component, you must
    setup the "Variables" table with the values below:

    * Variable 1:
      - Data Type: "Text"
      - Label: "Module"
      - Machine name: "module"
      - Usage: "Parameter"

    * Variable 2:
      - Data Type: "Text"
      - Label: "Delta"
      - Machine name: "delta"
      - Usage: "Parameter"

    * Variable 3:
      - Data Type: "Truth value"
      - Label: "Result"
      - Machine name: "result"
      - Usage: "Provided"

 4. After clicking "Continue", you will be present with the component
    edit page, where you can add your logic to determine if a block
    should be displayed or not.

    The block name being checked is available in the rule variable
     "module", and the module delta in "delta", so you can use the
     same component to control different blocks.

    To control if a module should be visible or not, your component
    *must* set the "result" provided (output) variable to a "True"
    value. The "result" variable defauls to "False", so if you do not
    set a "True" value explicitly, the block will be hidden by
    default.


FAQ
---

Q: My component is not listed in the Rules visibility vertical tab...

R: Check the "Variables" section of your component in the Rules
   UI. Your component must strictly use the variables/machine names as
   specified in the "CREATING RULES COMPONENTS" section above.