Commit 62b049f1 authored by gbyte.co's avatar gbyte.co

Add code documentation

parent c96c3523
...@@ -9,7 +9,8 @@ use Symfony\Component\HttpFoundation\Response; ...@@ -9,7 +9,8 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**
* SimplesitemapController. * Class SimplesitemapController
* @package Drupal\simple_sitemap\Controller
*/ */
class SimplesitemapController extends ControllerBase { class SimplesitemapController extends ControllerBase {
......
...@@ -6,7 +6,8 @@ use Drupal\Core\Form\FormStateInterface; ...@@ -6,7 +6,8 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\simple_sitemap\Form; use Drupal\simple_sitemap\Form;
/** /**
* SimplesitemapCustomLinksFrom * Class SimplesitemapCustomLinksForm
* @package Drupal\simple_sitemap\Form
*/ */
class SimplesitemapCustomLinksForm extends SimplesitemapFormBase { class SimplesitemapCustomLinksForm extends SimplesitemapFormBase {
...@@ -91,6 +92,10 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase { ...@@ -91,6 +92,10 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase {
} }
} }
/**
* @param $custom_links_string
* @return array
*/
private function getCustomLinks($custom_links_string) { private function getCustomLinks($custom_links_string) {
// Unify newline characters and explode into array. // Unify newline characters and explode into array.
$custom_links_string_lines = explode("\n", str_replace("\r\n", "\n", $custom_links_string)); $custom_links_string_lines = explode("\n", str_replace("\r\n", "\n", $custom_links_string));
......
...@@ -5,7 +5,8 @@ namespace Drupal\simple_sitemap\Form; ...@@ -5,7 +5,8 @@ namespace Drupal\simple_sitemap\Form;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
/** /**
* SimplesitemapSettingsFrom * Class SimplesitemapEntitiesForm
* @package Drupal\simple_sitemap\Form
*/ */
class SimplesitemapEntitiesForm extends SimplesitemapFormBase { class SimplesitemapEntitiesForm extends SimplesitemapFormBase {
......
...@@ -6,7 +6,8 @@ use Drupal\Core\Form\ConfigFormBase; ...@@ -6,7 +6,8 @@ use Drupal\Core\Form\ConfigFormBase;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* SimplesitemapFormBase * Class SimplesitemapFormBase
* @package Drupal\simple_sitemap\Form
*/ */
abstract class SimplesitemapFormBase extends ConfigFormBase { abstract class SimplesitemapFormBase extends ConfigFormBase {
...@@ -14,6 +15,13 @@ abstract class SimplesitemapFormBase extends ConfigFormBase { ...@@ -14,6 +15,13 @@ abstract class SimplesitemapFormBase extends ConfigFormBase {
protected $form; protected $form;
protected $pathValidator; protected $pathValidator;
/**
* SimplesitemapFormBase constructor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $generator
* @param $form
* @param $path_validator
*/
public function __construct($generator, $form, $path_validator) { public function __construct($generator, $form, $path_validator) {
$this->generator = $generator; $this->generator = $generator;
$this->form = $form; $this->form = $form;
......
...@@ -5,7 +5,8 @@ namespace Drupal\simple_sitemap\Form; ...@@ -5,7 +5,8 @@ namespace Drupal\simple_sitemap\Form;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
/** /**
* SimplesitemapSettingsFrom * Class SimplesitemapSettingsForm
* @package Drupal\simple_sitemap\Form
*/ */
class SimplesitemapSettingsForm extends SimplesitemapFormBase { class SimplesitemapSettingsForm extends SimplesitemapFormBase {
...@@ -118,6 +119,10 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase { ...@@ -118,6 +119,10 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase {
} }
} }
/**
* @param array $form
* @param \Drupal\Core\Form\FormStateInterface $form_state
*/
public function generateSitemap(array &$form, FormStateInterface $form_state) { public function generateSitemap(array &$form, FormStateInterface $form_state) {
$this->generator->generateSitemap(); $this->generator->generateSitemap();
} }
......
...@@ -5,9 +5,8 @@ namespace Drupal\simple_sitemap; ...@@ -5,9 +5,8 @@ namespace Drupal\simple_sitemap;
use Drupal\Core\Entity\ContentEntityTypeInterface; use Drupal\Core\Entity\ContentEntityTypeInterface;
/** /**
* Simplesitemap class. * Class Simplesitemap
* * @package Drupal\simple_sitemap
* Main module class.
*/ */
class Simplesitemap { class Simplesitemap {
...@@ -318,11 +317,19 @@ class Simplesitemap { ...@@ -318,11 +317,19 @@ class Simplesitemap {
} }
} }
/**
* @param $entity
* @return mixed
*/
public function getEntityInstanceBundleName($entity) { public function getEntityInstanceBundleName($entity) {
return $entity->getEntityTypeId() == 'menu_link_content' return $entity->getEntityTypeId() == 'menu_link_content'
? $entity->getMenuName() : $entity->bundle(); // Menu fix. ? $entity->getMenuName() : $entity->bundle(); // Menu fix.
} }
/**
* @param $entity
* @return string
*/
public function getBundleEntityTypeId($entity) { public function getBundleEntityTypeId($entity) {
return $entity->getEntityTypeId() == 'menu' return $entity->getEntityTypeId() == 'menu'
? 'menu_link_content' : $entity->getEntityType()->getBundleOf(); // Menu fix. ? 'menu_link_content' : $entity->getEntityType()->getBundleOf(); // Menu fix.
...@@ -452,6 +459,10 @@ class Simplesitemap { ...@@ -452,6 +459,10 @@ class Simplesitemap {
return $entity_types; return $entity_types;
} }
/**
* @param $entity_type_id
* @return bool
*/
public function entityTypeIsAtomic($entity_type_id) { public function entityTypeIsAtomic($entity_type_id) {
if ($entity_type_id == 'menu_link_content') // Menu fix. if ($entity_type_id == 'menu_link_content') // Menu fix.
return FALSE; return FALSE;
......
...@@ -5,7 +5,8 @@ namespace Drupal\simple_sitemap; ...@@ -5,7 +5,8 @@ namespace Drupal\simple_sitemap;
use \XMLWriter; use \XMLWriter;
/** /**
* SitemapGenerator class. * Class SitemapGenerator
* @package Drupal\simple_sitemap
*/ */
class SitemapGenerator { class SitemapGenerator {
......
...@@ -5,8 +5,11 @@ namespace Drupal\simple_sitemap\Tests; ...@@ -5,8 +5,11 @@ namespace Drupal\simple_sitemap\Tests;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
* Class SimplesitemapTest
*
* Tests Simple XML sitemap functional integration. * Tests Simple XML sitemap functional integration.
* *
* @package Drupal\simple_sitemap\Tests
* @group simple_sitemap * @group simple_sitemap
*/ */
class SimplesitemapTest extends WebTestBase { class SimplesitemapTest extends WebTestBase {
......
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