diff --git a/src/Plugin/views/sort/DraggableViewsSort.php b/src/Plugin/views/sort/DraggableViewsSort.php index 4216937..0f49ad2 100644 --- a/src/Plugin/views/sort/DraggableViewsSort.php +++ b/src/Plugin/views/sort/DraggableViewsSort.php @@ -19,6 +19,7 @@ class DraggableViewsSort extends Standard { //dpm($this->view->id()); $options = parent::defineOptions(); $options['view_name'] = ['default' => $this->view->id()]; + $options['view_display'] = ['default' => '']; return $options; } @@ -44,10 +45,17 @@ class DraggableViewsSort extends Standard { $form['view_name'] = array( '#type' => 'select', - '#title' => $this->t('Source view'), + '#title' => $this->t('View name'), '#options' => $draggableviews, '#default_value' => $this->options['view_name'], ); + + $form['view_display'] = array( + '#type' => 'textfield', + '#title' => $this->t('View display'), + '#default_value' => $this->options['view_display'], + '#description' => $this->t('If want to use the draggableviews information a specific display of the selected view, type it here. Otherwise the whole view will be used.'), + ); } public function query() { @@ -55,6 +63,9 @@ class DraggableViewsSort extends Standard { $table = &$this->query->getTableInfo($this->tableAlias); if ($table) { $table['join']->extra = [['field' => 'view_name', 'value' => $this->options['view_name']]]; + if (!empty($this->options['view_display'])) { + $table['join']->extra[] = ['field' => 'view_display', 'value' => $this->options['view_display']]; + } } } }