forked from wellebee/viewfield
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from kviatkovskyi/patch
Fix issue with empty argument and update.
- Loading branch information
Showing
8 changed files
with
291 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Drupal\viewfield\Plugin\views\display; | ||
|
||
use Drupal\views\Plugin\views\display\DisplayPluginBase; | ||
|
||
/** | ||
* The plugin that handles an embed display. | ||
* | ||
* @ingroup views_display_plugins | ||
* | ||
* @todo: Wait until annotations/plugins support access methods. | ||
* no_ui => !\Drupal::config('views.settings')->get('ui.show.display_embed'), | ||
* | ||
* @ViewsDisplay( | ||
* id = "viewfield", | ||
* title = @Translation("Viewfield"), | ||
* help = @Translation("Provide a display which can be embedded using the views api."), | ||
* theme = "views_view", | ||
* uses_menu_links = FALSE | ||
* ) | ||
*/ | ||
class ViewFieldDisplay extends DisplayPluginBase { | ||
|
||
public function displaysExposed() { | ||
return FALSE; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace Drupal\viewfield\Plugin\views\exposed_form; | ||
|
||
use Drupal\views\Plugin\views\exposed_form\Basic; | ||
use Drupal\Core\Form\FormState; | ||
use Drupal\Core\Form\FormStateInterface; | ||
|
||
/** | ||
* Exposed form plugin that provides a basic exposed form. | ||
* | ||
* @ingroup views_exposed_form_plugins | ||
* | ||
* @ViewsExposedForm( | ||
* id = "viewfield_exposed_form", | ||
* title = @Translation("Viewfield Form"), | ||
* help = @Translation("Only for field settings") | ||
* ) | ||
*/ | ||
class ViewFieldExposedForm extends Basic { | ||
/** | ||
* Render the exposed filter form. | ||
* | ||
* This actually does more than that; because it's using FAPI, the form will | ||
* also assign data to the appropriate handlers for use in building the | ||
* query. | ||
*/ | ||
public function renderExposedForm($block = FALSE) { | ||
//return []; | ||
// Deal with any exposed filters we may have, before building. | ||
|
||
$form_state = (new FormState()) | ||
->setStorage([ | ||
'view' => $this->view, | ||
'display' => &$this->view->display_handler->display, | ||
'rerender' => TRUE, | ||
]) | ||
->setMethod('get') | ||
->setAlwaysProcess() | ||
->disableRedirect(); | ||
|
||
// Some types of displays (eg. attachments) may wish to use the exposed | ||
// filters of their parent displays instead of showing an additional | ||
// exposed filter form for the attachment as well as that for the parent. | ||
if (!$this->view->display_handler->displaysExposed() || ($this->view->display_handler->getOption('exposed_block'))) { | ||
$form_state->set('rerender', NULL); | ||
} | ||
|
||
$form = \Drupal::formBuilder()->buildForm('\Drupal\views\Form\ViewsExposedForm', $form_state); | ||
return []; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.