You are here

public function Simplesitemap::removeCustomLink in Simple XML sitemap 8.2

Removes a custom path from the sitemap settings.

Parameters

string $path:

Return value

$this

File

src/Simplesitemap.php, line 690

Class

Simplesitemap
Class Simplesitemap @package Drupal\simple_sitemap

Namespace

Drupal\simple_sitemap

Code

public function removeCustomLink($path) {
  $custom_links = $this
    ->getCustomLinks(FALSE);
  foreach ($custom_links as $key => $link) {
    if ($link['path'] === $path) {
      unset($custom_links[$key]);
      $custom_links = array_values($custom_links);
      $this->configFactory
        ->getEditable('simple_sitemap.custom')
        ->set('links', $custom_links)
        ->save();
      break;
    }
  }
  return $this;
}