| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | Copyright CiviCRM LLC. All rights reserved. | |
| 5 | | | |
| 6 | | This work is published under the GNU AGPLv3 license with some | |
| 7 | | permitted exceptions and without any warranty. For full license | |
| 8 | | and copyright information, see https://civicrm.org/licensing | |
| 9 | +--------------------------------------------------------------------+ |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * @package CiviCRM_APIv3 |
| 14 | */ |
| 15 | |
| 16 | /** |
| 17 | * Provide meta-data for this api. |
| 18 | * |
| 19 | * @param array $params |
| 20 | */ |
| 21 | function _civicrm_api3_generic_validate_spec(&$params) { |
| 22 | $params['action']['api.required'] = TRUE; |
| 23 | $params['action']['title'] = ts('API Action'); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Generic api wrapper used for validation of entity-action pair. |
| 28 | * |
| 29 | * @param array $apiRequest |
| 30 | * |
| 31 | * @return mixed |
| 32 | */ |
| 33 | function civicrm_api3_generic_validate($apiRequest) { |
| 34 | $errors = _civicrm_api3_validate($apiRequest['entity'], $apiRequest['params']['action'], $apiRequest['params']); |
| 35 | |
| 36 | return civicrm_api3_create_success($errors, $apiRequest['params'], $apiRequest['entity'], 'validate'); |
| 37 | } |