public function CourseObjectWebform::getWarnings in Course 8.2
Same name and namespace in other branches
- 8.3 modules/course_webform/src/Plugin/course/CourseObject/CourseObjectWebform.php \Drupal\course_webform\Plugin\course\CourseObject\CourseObjectWebform::getWarnings()
- 3.x modules/course_webform/src/Plugin/course/CourseObject/CourseObjectWebform.php \Drupal\course_webform\Plugin\course\CourseObject\CourseObjectWebform::getWarnings()
Return a list of warning strings about this handler.
For example, if a user adds a quiz to a course with no questions, trigger a message.
Overrides CourseHandler::getWarnings
File
- modules/
course_webform/ src/ Plugin/ course/ CourseObject/ CourseObjectWebform.php, line 37
Class
- CourseObjectWebform
- Plugin annotation @CourseObject( id = "webform", label = "Webform", handlers = { "fulfillment" = "\Drupal\course_webform\Plugin\course\CourseObject\CourseObjectWebformFulfillment" } )
Namespace
Drupal\course_webform\Plugin\course\CourseObjectCode
public function getWarnings() {
$warnings = parent::getWarnings();
$webform = Webform::load($this
->getInstanceId());
if ($this
->getInstanceId() && !$webform
->getElementsDecoded()) {
$link = Link::createFromRoute(t('add questions'), 'entity.webform.edit_form', [
'webform' => $webform
->id(),
])
->toString();
$warnings[] = t('The Webform has no questions. Please @link.', array(
'@link' => $link,
));
}
return $warnings;
}