Commit bf10f1a2 authored by RenatoG's avatar RenatoG Committed by RenatoG

Issue #2907587 by RenatoG: Fix all unused variables

parent 0413eeeb
......@@ -79,11 +79,9 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('xmlsitemap.settings');
$entity_types = $this->entityTypeManager->getDefinitions();
$labels = [];
$default = [];
$anonymous_user = new AnonymousUserSession();
$bundles = $this->entityTypeBundleInfo->getAllBundleInfo();
foreach ($entity_types as $entity_type_id => $entity_type) {
......@@ -186,8 +184,6 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
$bundles = $this->entityTypeBundleInfo->getAllBundleInfo();
$values = $form_state->getValues();
$entity_values = $values['entity_types'];
$config = $this->config('xmlsitemap.settings');
$settings = $form_state->getValue('settings');
foreach ($entity_values as $key => $value) {
if ($value) {
foreach ($bundles[$key] as $bundle_key => $bundle_value) {
......
......@@ -95,10 +95,8 @@ class XmlSitemapForm extends EntityForm {
* {@inheritdoc}
*/
public function delete(array $form, FormStateInterface $form_state) {
$destination = [];
$request = $this->getRequest();
if ($request->query->has('destination')) {
$destination = drupal_get_destination();
$request->query->remove('destination');
}
$form_state->setRedirect('xmlsitemap.admin_delete', ['xmlsitemap' => $this->entity->id()]);
......
......@@ -35,7 +35,6 @@ class XmlSitemapLinkBundleSettingsForm extends ConfigFormBase {
public function buildForm(array $form, FormStateInterface $form_state, $entity = NULL, $bundle = NULL) {
$this->entity_type = $entity;
$this->bundle_type = $bundle;
$config = $this->config('xmlsitemap.settings');
$request = $this->getRequest();
if (!$request->isXmlHttpRequest() && $admin_path = xmlsitemap_get_bundle_path($entity, $bundle)) {
......@@ -72,7 +71,6 @@ class XmlSitemapLinkBundleSettingsForm extends ConfigFormBase {
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$entity = $form['xmlsitemap']['#entity'];
$bundle = $form['xmlsitemap']['#bundle'];
// Handle new bundles by fetching the proper bundle key value from the form
......
......@@ -220,6 +220,7 @@ class XmlSitemapUnitTest extends XmlSitemapTestBase {
*/
public function testUpdateLinks() {
// Add our testing data.
// @codingStandardsIgnoreLine
$links = [];
$links[1] = $this->addSitemapLink(['subtype' => 'group1']);
$links[2] = $this->addSitemapLink(['subtype' => 'group1']);
......@@ -264,8 +265,10 @@ class XmlSitemapUnitTest extends XmlSitemapTestBase {
*/
public function testDuplicatePaths() {
$this->drupalLogin($this->admin_user);
// @codingStandardsIgnoreStart
$link1 = $this->addSitemapLink(['loc' => '/duplicate']);
$link2 = $this->addSitemapLink(['loc' => '/duplicate']);
// @codingStandardsIgnoreEnd
$this->regenerateSitemap();
$this->drupalGetSitemap();
$this->assertUniqueText('duplicate');
......
......@@ -457,7 +457,6 @@ class XmlSitemapGenerator implements XmlSitemapGeneratorInterface {
*/
public function batchVariableSet(array $variables) {
$state_variables = xmlsitemap_state_variables();
$config_variables = xmlsitemap_config_variables();
foreach ($variables as $variable => $value) {
if (isset($state_variables[$variable])) {
$this->state->set($variable, $value);
......
......@@ -247,10 +247,12 @@ class XmlSitemapWriter extends \XMLWriter {
throw new XmlSitemapGenerationException(t('Unknown error occurred while writing to file @file.', ['@file' => $this->uri]));
}
// @codingStandardsIgnoreStart
if (xmlsitemap_var('gz')) {
$file_gz = $file . '.gz';
file_put_contents($file_gz, gzencode(file_get_contents($file), 9));
}
// @codingStandardsIgnoreEnd
return $return;
}
......
......@@ -332,7 +332,6 @@ function xmlsitemap_uninstall() {
$entity_types = \Drupal::entityTypeManager()->getDefinitions();
$bundles = \Drupal::service('entity_type.bundle.info')->getAllBundleInfo();
$state_variables = [];
foreach ($entity_types as $entity_type_id => $entity_type) {
if (isset($bundles[$entity_type_id])) {
foreach ($bundles[$entity_type_id] as $bundle_id => $bundle) {
......
......@@ -493,7 +493,7 @@ function xmlsitemap_check_all_directories() {
$directories = array();
$sitemaps = xmlsitemap_sitemap_load_multiple(FALSE);
foreach ($sitemaps as $smid => $sitemap) {
foreach ($sitemaps as $sitemap) {
$directory = xmlsitemap_get_directory($sitemap);
$directories[$directory] = $directory;
}
......@@ -640,7 +640,7 @@ function xmlsitemap_get_link_info($type = NULL, $reset = FALSE) {
if (empty($uri_callback) || !isset($entity_type->xmlsitemap)) {
// Remove any non URL-able or XML sitemap un-supported entites.
}
foreach (\Drupal::service('entity_type.bundle.info')->getBundleInfo($entity_type->id()) as $bundle_key => $bundle) {
foreach (\Drupal::service('entity_type.bundle.info')->getBundleInfo($entity_type->id()) as $bundle) {
if (!isset($bundle['xmlsitemap'])) {
// Remove any un-supported entity bundles.
}
......@@ -1509,7 +1509,6 @@ function xmlsitemap_form_alter(array &$form, FormStateInterface $form_state, $fo
$entity = $form_controller ? $form_controller->getEntity() : NULL;
$entity_type = $entity ? $entity->getEntityTypeId() : NULL;
$bundle = $entity ? $entity->bundle() : NULL;
$anonymous_user = new AnonymousUserSession();
if (!$form_controller) {
return;
......@@ -1931,7 +1930,6 @@ function xmlsitemap_sitemap_multiple_update(array $smids) {
function xmlsitemap_add_form_entity_summary(&$form, $entity, array $entity_info) {
$priorities = xmlsitemap_get_priority_options(NULL, FALSE);
$statuses = xmlsitemap_get_status_options(NULL);
$destination = drupal_get_destination();
$rows = array();
$totals = array('total' => 0, 'indexed' => 0, 'visible' => 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment