-
-
Save UshaMakoa/ed7d6f27c78b8eddc5378da2ec29c3d4 to your computer and use it in GitHub Desktop.
Custom activity status update VBO .module file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function civicrm_customs_action_info() { | |
return array( | |
'civicrm_customs_update_activity_status_action' => array( | |
'type' => 'civicrm_activity', | |
'label' => t('Update Activity Status'), | |
'behavior' => array('views_property'), | |
'configurable' => FALSE, | |
'vbo_configurable' => TRUE, | |
'triggers' => array('any'), | |
'pass rows' => TRUE, | |
), | |
); | |
} | |
// The function name must be [action_name] + '_form'. | |
function civicrm_customs_update_activity_status_action_form($settings, &$form_state) { | |
civicrm_initialize(); | |
$activity_status_options_result = civicrm_api3('Activity', 'getoptions', [ | |
'field' => "activity_status_id", | |
]); | |
$form = array(); | |
$form['activity_status'] = array( | |
'#type' => 'select', | |
'#title' => t('Activity Status'), | |
'#options' => $activity_status_options_result['values'], | |
'#required' => TRUE, | |
'#default_value' => "1", | |
); | |
return $form; | |
} | |
// The function name must be [action_name] + '_submit'. | |
function civicrm_customs_update_activity_status_action_submit($form, $form_state) { | |
$return = array(); | |
$return['activity_status'] = $form_state['values']['activity_status']; | |
return $return; //Note, return value here must be an array. | |
} | |
function civicrm_customs_update_activity_status_action(&$entity, $context) { | |
$result = civicrm_api3('Activity', 'create', [ | |
'id' => $entity->id, | |
'activity_status_id' => $context['activity_status'], | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment