class crm_core_contact_context_condition_contact_type in CRM Core 7
Same name and namespace in other branches
- 8 modules/crm_core_contact/legacy/context/crm_core_contact_context_condition_contact_type.inc \crm_core_contact_context_condition_contact_type
- 8.2 modules/crm_core_contact/legacy/context/crm_core_contact_context_condition_contact_type.inc \crm_core_contact_context_condition_contact_type
Expose node views/node forms of specific node types as a context condition.
Hierarchy
Expanded class hierarchy of crm_core_contact_context_condition_contact_type
3 string references to 'crm_core_contact_context_condition_contact_type'
- crm_core_contact_context_page_condition in modules/
crm_core_contact/ crm_core_contact.context.inc - Implements hook_context_page_condition().
- crm_core_contact_context_plugins in modules/
crm_core_contact/ crm_core_contact.context.inc - Implements hook_context_plugins().
- crm_core_contact_context_registry in modules/
crm_core_contact/ crm_core_contact.context.inc - Implements hook_context_registry().
File
- modules/
crm_core_contact/ includes/ context/ crm_core_contact_context_condition_contact_type.inc, line 26 - Class for determining if the user is in the right contact context.
View source
class crm_core_contact_context_condition_contact_type extends context_condition {
function condition_values() {
$values = array();
foreach (crm_core_contact_types() as $type) {
$values[$type->type] = check_plain($type->name);
}
return $values;
}
function options_form($context) {
$defaults = $this
->fetch_from_context($context, 'options');
return array(
'contact_form' => array(
'#title' => t('Set on contact form'),
'#type' => 'select',
'#options' => array(
CONTEXT_CRM_CONTACT_VIEW => t('No'),
CONTEXT_CRM_CONTACT_NODE_FORM => t('Yes'),
CONTEXT_CRM_CONTACT_NODE_FORM_ONLY => t('Only on contact form'),
),
'#description' => t('Set this context on contact forms'),
'#default_value' => isset($defaults['contact_form']) ? $defaults['contact_form'] : TRUE,
),
);
}
function execute($contact, $op) {
foreach ($this
->get_contexts($contact->type) as $context) {
$options = $this
->fetch_from_context($context, 'options');
if ($op === 'form') {
$options = $this
->fetch_from_context($context, 'options');
if (!empty($options['contact_form']) && in_array($options['contact_form'], array(
CONTEXT_CRM_CONTACT_NODE_FORM,
CONTEXT_CRM_CONTACT_NODE_FORM_ONLY,
))) {
$this
->condition_met($context, $contact->type);
}
}
elseif (empty($options['contact_form']) || $options['contact_form'] != CONTEXT_CRM_CONTACT_NODE_FORM_ONLY) {
$this
->condition_met($context, $contact->type);
}
}
}
}
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 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. | ||
crm_core_contact_context_condition_contact_type:: |
function |
Condition values. Overrides context_condition:: |
||
crm_core_contact_context_condition_contact_type:: |
function | |||
crm_core_contact_context_condition_contact_type:: |
function |
Options form. Provide additional options for your condition. Overrides context_condition:: |