Commit 566f2959 authored by Karl Yoder's avatar Karl Yoder Committed by Devin Zuczek
Browse files

Issue #3312947 by kyoder, djdevin: More specific text for Take Course button

parent 738ab785
Loading
Loading
Loading
Loading
+1 −1
Changes for modules/course_node/tests/src/Functional/CourseNodeTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ class CourseNodeTest extends CourseTestBase {
    $this->drupalLogin($this->student_user);
    $this->drupalGet('node/1');
    $this->clickLink('Course title 1');
    $this->clickLink('Take course');
    $this->clickLink('Enroll');
    $this->clickLink('Complete');
  }

+17 −1
Changes for src/View/CourseViewBuilder.php: 17 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -33,10 +33,26 @@ class CourseViewBuilder extends EntityViewBuilder {
    }
    else {
      // Render take course button.
      $text = 'Enroll';
      // Enrolled.
      if ($enrollment) {
        // Completed.
        if ($enrollment->isComplete()) {
          $text = 'Review course';
        }
        else {
          // Not started.
          $text = 'Take course';
          // In progress.
          if (!empty($enrollment->get('section_name')->getValue())) {
            $text = 'Resume course';
          }
        }
      }
      $build['course'] = [
        '#theme' => 'course_take_course_button',
        '#course' => $course,
        '#title' => $enrollment && $enrollment->isComplete() ? t('Review course') : t('Take course'),
        '#title' => $this->t($text),
      ];
    }

+1 −1
Changes for tests/src/Functional/CourseWorkflowTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ class CourseWorkflowTest extends CourseTestBase {
    $this->assertSession()->responseContains('This course is not complete.');

    $this->drupalGet("course/{$course->id()}");
    $this->assertSession()->linkExistsExact(t('Take course'));
    $this->assertSession()->linkExistsExact(t('Resume course'));
    $this->drupalGet("course/{$course->id()}/take");
    $this->assertLink('Course object 1');
    $this->assertNoLink('Course object 2');