Actions II: Intermediate

Use permissions, categories, and other parameters from the actions.ini file to improve your action’s integration into the application.

In the previous section we introduced actions and action controllers as a means of adding custom pages to your Xataface application.  In this section we will deal with some fine-tuning issues such as:

  • Restricting who can use and see your action using permissions.
  • Making your action appear in the correct menu using the category attribute.
  • Applying rules to define when your action is visible in its menu.
  • Using the ActionTool class to work with your actions programmatically.

actions.ini file options:

There are quite a few options that you can set for your actions in the actions.ini file:

label
The name that will appear in the interface for your action if it is bound to a button, link, menu-item, or tab.
description
A descriptive sentence about your action (may appear in a roll-over in the interface for your action)
permission
The name of the permission that is required to be able to see and perform your action.  e.g. permission=edit
condition
A PHP expression that evaluates to a boolean to define whether your action should be visible in a given context.  e.g. condition = “$query[‘-mode’]==’browse’”
url
When your action is listed in a menu or as a link, this is the url that it should point to.  e.g.: url = “{$this->url(‘-action=delete&-delete-one=1’)}”
icon
The URL to an icon that can be used for your action.  e.g.: icon = “${dataface_url}/images/document_icon.gif”
category
You can group your actions together by assigning them to the same category.

More to come…

| Previous: Actions I: The Basics | Up to Contents | Next: This is a test | | — | — | — |