Chris@5: {% import 'lib/di.twig' as di %} Chris@0: '']; Chris@0: return $options; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function buildOptionsForm(&$form, FormStateInterface $form_state) { Chris@5: $form['example'] = [ Chris@0: '#type' => 'textfield', Chris@5: '#title' => $this->t('Example'), Chris@5: '#default_value' => $this->options['example'], Chris@0: ]; Chris@0: } Chris@0: Chris@5: {% endif %} Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function getArgument() { Chris@0: Chris@0: // @DCG Chris@0: // Here is the place where you should create a default argument for the Chris@0: // contextual filter. The source of this argument depends on your needs. Chris@0: // For example, you can extract the value from the URL or fetch it from Chris@0: // some fields of the current viewed entity. Chris@5: $argument = 123; Chris@0: Chris@0: return $argument; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function getCacheMaxAge() { Chris@0: return Cache::PERMANENT; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function getCacheContexts() { Chris@5: // @DCG Use 'url' context if the argument comes from URL. Chris@5: return []; Chris@0: } Chris@0: Chris@0: }