function crm_core_contact_context_condition_contact_type::execute in CRM Core 8.2
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::execute()
- 7 modules/crm_core_contact/includes/context/crm_core_contact_context_condition_contact_type.inc \crm_core_contact_context_condition_contact_type::execute()
File
- modules/
crm_core_contact/ legacy/ context/ crm_core_contact_context_condition_contact_type.inc, line 55 - Class for determining if the user is in the right contact context.
Class
- crm_core_contact_context_condition_contact_type
- Expose node views/node forms of specific node types as a context condition.
Code
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);
}
}
}