Skip to content
Snippets Groups Projects

Update 3 files

Files
3
@@ -3,7 +3,7 @@
namespace Drupal\views_csv_source\Plugin\views\argument;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
use Drupal\views\Plugin\views\argument\StringArgument;
use Drupal\views_csv_source\Plugin\views\ColumnSelectorTrait;
/**
@@ -13,15 +13,44 @@ use Drupal\views_csv_source\Plugin\views\ColumnSelectorTrait;
*
* @ViewsArgument("views_csv_source_argument")
*/
class ViewsCsvArgument extends ArgumentPluginBase {
class ViewsCsvArgument extends StringArgument {
use ColumnSelectorTrait;
/**
* Build the summary query based on a string.
*/
protected function summaryQuery() {
$this->ensureMyTable();
}
/**
* Add this filter to the query.
*/
public function query($group_by = FALSE) {
$this->query->addFilter($this);
$argument = $this->argument;
if (!empty($this->options['transform_dash'])) {
$argument = strtr($argument, '-', ' ');
}
if (!empty($this->options['break_phrase'])) {
$this->unpackArgumentValue();
}
else {
$this->value = [$argument];
$this->operator = 'or';
}
$this->ensureMyTable();
if (empty($this->options['glossary'])) {
$field = $this->options['key'];
}
if (count($this->value) > 1) {
$argument = $this->value;
}
$this->query->addWhere(0, $field, $argument, '=');
}
/**
@@ -48,6 +77,7 @@ class ViewsCsvArgument extends ArgumentPluginBase {
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form = $this->buildKeyOptionElement($form);
}
Loading