function CourseObjectNode::getOptionsSummary in Course 3.x
Same name and namespace in other branches
- 8.3 modules/course_content/src/Course/Object/CourseObjectNode.php \Drupal\course_content\Course\Object\CourseObjectNode::getOptionsSummary()
- 8.2 modules/course_content/src/Course/Object/CourseObjectNode.php \Drupal\course_content\Course\Object\CourseObjectNode::getOptionsSummary()
Make the "Edit instance" link use a dialog.
Overrides CourseObject::getOptionsSummary
File
- modules/
course_content/ src/ Course/ Object/ CourseObjectNode.php, line 405
Class
- CourseObjectNode
- A course object that uses a node as a base.
Namespace
Drupal\course_content\Course\ObjectCode
function getOptionsSummary() {
$summary = parent::getOptionsSummary();
if (is_a($summary['instance'], GeneratedLink::class)) {
$url = $this
->getEditUrl();
$url
->setOption('query', \Drupal::service('redirect.destination')
->getAsArray());
$url
->setOption('attributes', [
'class' => 'use-ajax',
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => 800,
]),
]);
$link = Link::fromTextAndUrl(t('Edit instance'), $url)
->toString();
$summary['instance'] = $link;
}
return $summary;
}