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

Add code documentation

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