class domaincontext_context_condition_domain in Domain Context 7
Same name and namespace in other branches
- 6 plugins/domaincontext_context_condition_domain.inc \domaincontext_context_condition_domain
Expose domains as a context condition.
Hierarchy
- class \context_condition
Expanded class hierarchy of domaincontext_context_condition_domain
2 string references to 'domaincontext_context_condition_domain'
- domaincontext_context_plugins in ./
domaincontext.module - Implements hook_context_plugins().
- domaincontext_context_registry in ./
domaincontext.module - Implements hook_context_registry().
File
- plugins/
domaincontext_context_condition_domain.inc, line 10 - Context plugin to supply the domain as a context condition.
View source
class domaincontext_context_condition_domain extends context_condition {
/**
* Fetches condition values.
*/
function condition_values() {
$values = array();
$format = domain_select_format();
foreach (domain_domains() as $data) {
$data['domain_id'] == 0 ? $key = -1 : ($key = $data['domain_id']);
if ($data['valid'] || user_access('access inactive domains')) {
$values[$key] = empty($format) ? check_plain($data['sitename']) : $data['sitename'];
}
}
return $values;
}
/**
* Executes condition callback.
*/
function execute() {
$domain = domain_get_domain();
$domain_id = $domain['domain_id'];
if ($domain_id == 0) {
$domain_id = -1;
}
$this->values[$domain_id] = array();
$contexts = $this
->get_contexts($domain_id);
foreach ($contexts as $context) {
$this->values[$domain_id][] = $context->name;
$this
->condition_met($context, $domain_id);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
context_condition:: |
property | |||
context_condition:: |
property | |||
context_condition:: |
property | |||
context_condition:: |
property | |||
context_condition:: |
function | Condition form. | 3 | |
context_condition:: |
function | Condition form submit handler. | 2 | |
context_condition:: |
function | Marks a context as having met this particular condition. | ||
context_condition:: |
function | Check whether this condition is used by any contexts. Can be used to prevent expensive condition checks from being triggered when no contexts use this condition. | ||
context_condition:: |
function | Context editor form for conditions. | 2 | |
context_condition:: |
function | Context editor form submit handler. | ||
context_condition:: |
function | Retrieve options from the context provided. | ||
context_condition:: |
function | Retrieve all contexts with the condition value provided. | 2 | |
context_condition:: |
function | Options form. Provide additional options for your condition. | 4 | |
context_condition:: |
function | Options form submit handler. | ||
context_condition:: |
function | Settings form. Provide variable settings for your condition. | ||
context_condition:: |
function | Clone our references when we're being cloned. | ||
context_condition:: |
function | Constructor. Do not override. | ||
domaincontext_context_condition_domain:: |
function |
Fetches condition values. Overrides context_condition:: |
||
domaincontext_context_condition_domain:: |
function | Executes condition callback. |