You are here

function course_uc_payment_is_first in Course 3.x

Same name and namespace in other branches
  1. 8.3 modules/course_uc/course_uc.module \course_uc_payment_is_first()
  2. 8.2 modules/course_uc/course_uc.module \course_uc_payment_is_first()
  3. 7.2 modules/course_uc/course_uc.module \course_uc_payment_is_first()
  4. 7 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

3 calls to course_uc_payment_is_first()
course_commerce_form_alter in modules/course_commerce/course_commerce.module
Implements hook_form_alter().
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 222

Code

function course_uc_payment_is_first($course) {
  $courseObjects = $course
    ->getObjects();
  $first = reset($courseObjects);
  foreach ($courseObjects as $courseObject) {
    if ($first
      ->id() == $courseObject
      ->id() && $courseObject
      ->getComponent() == 'ubercart') {
      return TRUE;
    }
  }
  return FALSE;
}