Standard.php in Views XML Backend 8
File
src/Plugin/views/argument/Standard.php
View source
<?php
namespace Drupal\views_xml_backend\Plugin\views\argument;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
use Drupal\views_xml_backend\AdminLabelTrait;
use Drupal\views_xml_backend\Xpath;
class Standard extends ArgumentPluginBase implements XmlArgumentInterface {
use AdminLabelTrait;
public function query($group_by = FALSE) {
$this->query
->addArgument($this);
}
protected function defineOptions() {
$options = parent::defineOptions();
$options['xpath_selector']['default'] = '';
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['xpath_selector'] = [
'#type' => 'textfield',
'#title' => $this
->t('XPath selector'),
'#description' => $this
->t('The field name in the table that will be used as the filter.'),
'#default_value' => $this->options['xpath_selector'],
'#required' => TRUE,
];
parent::buildOptionsForm($form, $form_state);
}
public function __toString() {
$xpath = $this->options['xpath_selector'];
$value = Xpath::escapeXpathString($this
->getValue());
return "{$xpath} = {$value}";
}
}
Classes
Name |
Description |
Standard |
Default implementation of the base argument plugin. |