Skip to content
Snippets Groups Projects
Commit 56e2b69d authored by Sidharth Soman's avatar Sidharth Soman Committed by Adriano
Browse files

Issue #3372951 by sidharth_soman: Fix the errors/warnings reported by Php_CodeSniffer

parent 5537c6ef
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ function prevnext_help($route_name, RouteMatchInterface $route_match) {
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Add a &quot;Previous/Next&quot; links to the node display.') . '</p>';
return $output;
default:
}
}
......@@ -33,7 +33,7 @@ function prevnext_help($route_name, RouteMatchInterface $route_match) {
*/
function prevnext_theme($existing, $type, $theme, $path) {
$themes = [];
$themes['prevnext'] = [
'variables' => [
'direction' => '',
......@@ -43,7 +43,7 @@ function prevnext_theme($existing, $type, $theme, $path) {
'void' => TRUE,
],
];
return $themes;
}
......@@ -52,10 +52,10 @@ function prevnext_theme($existing, $type, $theme, $path) {
*/
function prevnext_entity_extra_field_info() {
$extra = [];
$config = \Drupal::config('prevnext.settings');
$enabled_nodetypes = $config->get('prevnext_enabled_nodetypes');
if (!empty($enabled_nodetypes)) {
foreach ($enabled_nodetypes as $bundle_key => $bundle_name) {
if (!empty($bundle_name)) {
......@@ -72,7 +72,7 @@ function prevnext_entity_extra_field_info() {
}
}
}
return $extra;
}
......@@ -80,14 +80,14 @@ function prevnext_entity_extra_field_info() {
* Implements hook_ENTITY_TYPE_view().
*/
function prevnext_node_view(array &$build, Node $node, EntityViewDisplayInterface $display, $view_mode) {
// Checking if current node is configured for prevnext or not.
$config = \Drupal::config('prevnext.settings');
$enabled_nodetypes = $config->get('prevnext_enabled_nodetypes');
if (empty($enabled_nodetypes[$node->getType()])) {
return;
}
/** @var \Drupal\prevnext\PrevNextService $prevnext */
$prevnext = \Drupal::service('prevnext.service');
$previous_next = $prevnext->getPreviousNext($node);
......@@ -101,7 +101,7 @@ function prevnext_node_view(array &$build, Node $node, EntityViewDisplayInterfac
'node_list',
],
];
if ($display->getComponent('prevnext_previous')) {
$build['prevnext_previous'] = [
'#theme' => 'prevnext',
......@@ -114,7 +114,7 @@ function prevnext_node_view(array &$build, Node $node, EntityViewDisplayInterfac
'#cache' => $cache,
];
}
if ($display->getComponent('prevnext_next')) {
$build['prevnext_next'] = [
'#theme' => 'prevnext',
......@@ -127,7 +127,7 @@ function prevnext_node_view(array &$build, Node $node, EntityViewDisplayInterfac
'#cache' => $cache,
];
}
// Once these links will be cached inside the node rendered output, we will
// add a custom cache tag to allow invalidation of all these cached info
// later (for example when a new node of this type is created).
......
administer prevnext:
title: 'Administer the PrevNext module.'
description: 'Administer the settings for the PrevNext module.'
restrict access: TRUE
\ No newline at end of file
restrict access: TRUE
......@@ -6,7 +6,7 @@ use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class PrevNextSettingsForm.
* Form for the module settings.
*
* @package Drupal\prevnext\Form
*/
......@@ -43,13 +43,6 @@ class PrevNextSettingsForm extends ConfigFormBase {
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
......
......@@ -7,7 +7,7 @@ use Drupal\node\Entity\Node;
use Drupal\node\NodeInterface;
/**
* Class PrevNextService.
* Main service file.
*
* @package Drupal\prevnext
*/
......@@ -30,7 +30,7 @@ class PrevNextService implements PrevNextServiceInterface {
/**
* PrevNextService constructor.
*
* @param EntityTypeManagerInterface $entityTypeManager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager instance.
*/
public function __construct(EntityTypeManagerInterface $entityTypeManager) {
......
......@@ -5,7 +5,7 @@ namespace Drupal\prevnext;
use Drupal\node\Entity\Node;
/**
* Interface PrevNextServiceInterface.
* Interface for the main service file.
*
* @package Drupal\prevnext
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment