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