Skip to content
Snippets Groups Projects
Verified Commit 6127aa9f authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3491538 by quietone: Fix Drupal.Commenting.FunctionComment.Missing in views plugins, pt 3

parent 5a950cc2
Branches
Tags
9 merge requests!11197Issue #3506427 by eduardo morales alberti: Remove responsive_image.ajax from hook,!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!10786Issue #3490579 by shalini_jha, mstrelan: Add void return to all views...,!3478Issue #3337882: Deleted menus are not removed from content type config,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!579Issue #2230909: Simple decimals fail to pass validation,!459Resolve #3118590 "More tests",!213Issue #2906496: Give Media a menu item under Content
Showing
with 105 additions and 0 deletions
......@@ -19,6 +19,9 @@ class StatisticsLastUpdated extends Date {
// phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName, Drupal.Commenting.VariableComment.Missing
protected ?string $node_table;
/**
* {@inheritdoc}
*/
public function query() {
$this->ensureMyTable();
$this->node_table = $this->query->ensureTable('node_field_data', $this->relationship);
......
......
......@@ -69,6 +69,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
}
}
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
......@@ -124,6 +127,9 @@ public function query() {
$this->addAdditionalFields();
}
/**
* {@inheritdoc}
*/
public function preRender(&$values) {
$vocabularies = $this->vocabularyStorage->loadMultiple();
$this->field_alias = $this->aliases['nid'];
......@@ -157,10 +163,16 @@ public function preRender(&$values) {
}
}
/**
* {@inheritdoc}
*/
public function render_item($count, $item) {
return $item['name'];
}
/**
* {@inheritdoc}
*/
protected function documentSelfTokens(&$tokens) {
$tokens['{{ ' . $this->options['id'] . '__tid' . ' }}'] = $this->t('The taxonomy term ID for the term.');
$tokens['{{ ' . $this->options['id'] . '__name' . ' }}'] = $this->t('The taxonomy term name for the term.');
......@@ -168,6 +180,9 @@ protected function documentSelfTokens(&$tokens) {
$tokens['{{ ' . $this->options['id'] . '__vocabulary' . ' }}'] = $this->t('The name for the vocabulary the term belongs to.');
}
/**
* {@inheritdoc}
*/
protected function addSelfTokens(&$tokens, $item) {
foreach (['tid', 'name', 'vocabulary_vid', 'vocabulary'] as $token) {
$tokens['{{ ' . $this->options['id'] . '__' . $token . ' }}'] = $item[$token] ?? '';
......
......
......@@ -75,11 +75,17 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
$this->additional_fields['uid'] = ['table' => 'users_field_data', 'field' => 'uid'];
}
/**
* {@inheritdoc}
*/
public function query() {
$this->addAdditionalFields();
$this->field_alias = $this->aliases['uid'];
}
/**
* {@inheritdoc}
*/
public function preRender(&$values) {
$this->items = [];
......@@ -114,6 +120,9 @@ public function preRender(&$values) {
}
}
/**
* {@inheritdoc}
*/
public function render_item($count, $item) {
return $item['permission'];
}
......
......
......@@ -59,11 +59,17 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
$this->additional_fields['uid'] = ['table' => 'users_field_data', 'field' => 'uid'];
}
/**
* {@inheritdoc}
*/
public function query() {
$this->addAdditionalFields();
$this->field_alias = $this->aliases['uid'];
}
/**
* {@inheritdoc}
*/
public function preRender(&$values) {
$uids = [];
$this->items = [];
......@@ -91,15 +97,24 @@ public function preRender(&$values) {
}
}
/**
* {@inheritdoc}
*/
public function render_item($count, $item) {
return $item['role'];
}
/**
* {@inheritdoc}
*/
protected function documentSelfTokens(&$tokens) {
$tokens['{{ ' . $this->options['id'] . '__role' . ' }}'] = $this->t('The name of the role.');
$tokens['{{ ' . $this->options['id'] . '__rid' . ' }}'] = $this->t('The role machine-name of the role.');
}
/**
* {@inheritdoc}
*/
protected function addSelfTokens(&$tokens, $item) {
if (!empty($item['role'])) {
$tokens['{{ ' . $this->options['id'] . '__role }}'] = $item['role'];
......
......
......@@ -144,6 +144,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
$this->query = &$view->query;
}
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
......
......
......@@ -32,6 +32,9 @@ class Attachment extends DisplayPluginBase {
*/
protected $usesPager = FALSE;
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
......@@ -45,10 +48,16 @@ protected function defineOptions() {
return $options;
}
/**
* {@inheritdoc}
*/
public function execute() {
return $this->view->render($this->display['id']);
}
/**
* Gets the positions for the attachment in relation to the parent display.
*/
public function attachmentPositions($position = NULL) {
$positions = [
'before' => $this->t('Before'),
......@@ -296,6 +305,9 @@ public function displaysExposed() {
return $this->options['inherit_exposed_filters'] ? FALSE : TRUE;
}
/**
* {@inheritdoc}
*/
public function renderPager() {
return $this->usesPager() && $this->getOption('render_pager');
}
......
......
......@@ -463,6 +463,9 @@ public function defaultableSections($section = NULL) {
}
}
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = [
'defaults' => [
......
......
......@@ -19,6 +19,9 @@
)]
class InputRequired extends ExposedFormPluginBase {
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
......@@ -27,6 +30,9 @@ protected function defineOptions() {
return $options;
}
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
......@@ -40,6 +46,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
];
}
/**
* {@inheritdoc}
*/
public function submitOptionsForm(&$form, FormStateInterface $form_state) {
$exposed_form_options = $form_state->getValue('exposed_form_options');
$form_state->setValue(['exposed_form_options', 'text_input_required_format'], $exposed_form_options['text_input_required']['format']);
......@@ -47,6 +56,9 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) {
parent::submitOptionsForm($form, $form_state);
}
/**
* Indicates that the exposed filter has been applied.
*/
protected function exposedFilterApplied() {
static $cache = NULL;
if (!isset($cache)) {
......@@ -68,6 +80,9 @@ protected function exposedFilterApplied() {
return $cache;
}
/**
* {@inheritdoc}
*/
public function preRender($values) {
// Display the "text on demand" if needed. This is a site builder-defined
// text to display instead of results until the user selects and applies
......@@ -100,6 +115,9 @@ public function preRender($values) {
}
}
/**
* {@inheritdoc}
*/
public function query() {
if (!$this->exposedFilterApplied()) {
// We return with no query; this will force the empty text.
......
......
......@@ -714,6 +714,9 @@ public function buildGroupByForm(&$form, FormStateInterface $form_state) {
];
}
/**
* {@inheritdoc}
*/
public function submitGroupByForm(&$form, FormStateInterface $form_state) {
parent::submitGroupByForm($form, $form_state);
$item = &$form_state->get('handler')->options;
......@@ -966,10 +969,16 @@ protected function createEntityForGroupBy(EntityInterface $entity, ResultRow $ro
return $processed_entity;
}
/**
* {@inheritdoc}
*/
public function render_item($count, $item) {
return $this->renderer->render($item['rendered']);
}
/**
* {@inheritdoc}
*/
protected function documentSelfTokens(&$tokens) {
$field = $this->getFieldDefinition();
foreach ($field->getColumns() as $id => $column) {
......@@ -977,6 +986,9 @@ protected function documentSelfTokens(&$tokens) {
}
}
/**
* {@inheritdoc}
*/
protected function addSelfTokens(&$tokens, $item) {
$field = $this->getFieldDefinition();
foreach ($field->getColumns() as $id => $column) {
......
......
......@@ -480,6 +480,9 @@ public function useStringGroupBy() {
return TRUE;
}
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
......@@ -1809,6 +1812,9 @@ public function theme(ResultRow $values) {
return $output;
}
/**
* {@inheritdoc}
*/
public function themeFunctions() {
$themes = [];
$hook = 'views_view_field';
......@@ -1835,6 +1841,9 @@ public function themeFunctions() {
return $themes;
}
/**
* {@inheritdoc}
*/
public function adminLabel($short = FALSE) {
return $this->getField(parent::adminLabel($short));
}
......
......
......@@ -25,6 +25,9 @@ class MachineName extends FieldPluginBase {
*/
protected $valueOptions;
/**
* {@inheritdoc}
*/
public function getValueOptions() {
if (isset($this->valueOptions)) {
return;
......
......
......@@ -75,6 +75,9 @@
<include-pattern>core/modules/*/Plugin/views/cache/*</include-pattern>
<include-pattern>core/modules/*/Plugin/views/query/*</include-pattern>
<include-pattern>core/modules/*/Plugin/views/sort/*</include-pattern>
<include-pattern>core/modules/*/Plugin/views/display/*</include-pattern>
<include-pattern>core/modules/*/Plugin/views/exposed_form/*</include-pattern>
<include-pattern>core/modules/*/Plugin/views/field/*</include-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Drupal.Commenting.FunctionComment.MissingParamType">
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment