You are here

function civicrm_entity_price_set_field_allow_registration in CiviCRM Entity 7.2

Utility function to find modules with custom event registration access callbacks

Designed to make exceptions to access, user still required to have 'register for events' permission that comes with CiviCRM

Parameters

$entity_type:

$entity:

$field:

$instance:

null $account:

Return value

bool

1 call to civicrm_entity_price_set_field_allow_registration()
civicrm_entity_price_set_field_display_form_event in modules/civicrm_entity_price_set_field/includes/civicrm_entity_price_set_field.event_registration.inc
Form callback for event registration form

File

modules/civicrm_entity_price_set_field/includes/civicrm_entity_price_set_field.event_registration.inc, line 48
CiviCRM Entity Price Set Field, Form display formatter, event registration

Code

function civicrm_entity_price_set_field_allow_registration($entity_type, $entity, $field, $instance, $account = NULL) {
  if (is_null($account)) {
    global $user;
    $account = $user;
  }
  $callbacks = civicrm_entity_price_set_field_get_registration_access_callbacks_info();
  if (!empty($callbacks)) {
    foreach ($callbacks as $key => $info) {
      if (!empty($info['callback'])) {
        $result = call_user_func($info['callback'], $entity_type, $entity, $field, $instance, $account);
        if ($result === FALSE) {
          return FALSE;
        }
      }
    }
  }
  return TRUE;
}