You are here

public function crm_core_contact_context_condition_contact_type::options_form in CRM Core 8

Same name and namespace in other branches
  1. 8.2 modules/crm_core_contact/legacy/context/crm_core_contact_context_condition_contact_type.inc \crm_core_contact_context_condition_contact_type::options_form()
  2. 7 modules/crm_core_contact/includes/context/crm_core_contact_context_condition_contact_type.inc \crm_core_contact_context_condition_contact_type::options_form()

File

modules/crm_core_contact/legacy/context/crm_core_contact_context_condition_contact_type.inc, line 48
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

public function options_form($context) {
  $defaults = $this
    ->fetch_from_context($context, 'options');
  return [
    'contact_form' => [
      '#title' => t('Set on contact form'),
      '#type' => 'select',
      '#options' => [
        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,
    ],
  ];
}