function course_uc_payment_is_first in Course 8.3
Same name and namespace in other branches
- 8.2 modules/course_uc/course_uc.module \course_uc_payment_is_first()
- 7.2 modules/course_uc/course_uc.module \course_uc_payment_is_first()
- 7 modules/course_uc/course_uc.module \course_uc_payment_is_first()
- 3.x modules/course_uc/course_uc.module \course_uc_payment_is_first()
Check if the payment object in a course is the first object.
Return value
bool
2 calls to course_uc_payment_is_first()
- course_uc_course_enrollment_insert in modules/
course_uc/ course_uc.module - Implements hook_course_enroll().
- course_uc_form_alter in modules/
course_uc/ course_uc.module - Implements hook_form_alter().
File
- modules/
course_uc/ course_uc.module, line 219
Code
function course_uc_payment_is_first($course) {
$courseObjects = $course
->getObjects();
$first = reset($courseObjects);
foreach ($courseObjects as $courseObject) {
if ($first
->identifier() == $courseObject
->identifier() && $courseObject
->getComponent() == 'payment') {
return TRUE;
}
}
return FALSE;
}