function CourseObjectNode::getOptionsSummary in Course 8.2
Same name and namespace in other branches
- 8.3 modules/course_content/src/Course/Object/CourseObjectNode.php \Drupal\course_content\Course\Object\CourseObjectNode::getOptionsSummary()
- 3.x 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 399
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'], \Drupal\Core\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' => \Drupal\Component\Serialization\Json::encode([
'width' => 800,
]),
]);
$link = \Drupal\Core\Link::fromTextAndUrl(t('Edit instance'), $url)
->toString();
$summary['instance'] = $link;
}
return $summary;
}