Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
simple_sitemap
Commits
62b049f1
Commit
62b049f1
authored
Aug 27, 2016
by
Pawel G
Browse files
Add code documentation
parent
c96c3523
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/Controller/SimplesitemapController.php
View file @
62b049f1
...
...
@@ -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
{
...
...
src/Form/SimplesitemapCustomLinksForm.php
View file @
62b049f1
...
...
@@ -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
));
...
...
src/Form/SimplesitemapEntitiesForm.php
View file @
62b049f1
...
...
@@ -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
{
...
...
src/Form/SimplesitemapFormBase.php
View file @
62b049f1
...
...
@@ -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
;
...
...
src/Form/SimplesitemapSettingsForm.php
View file @
62b049f1
...
...
@@ -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
();
}
...
...
src/Simplesitemap.php
View file @
62b049f1
...
...
@@ -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
;
...
...
src/SitemapGenerator.php
View file @
62b049f1
...
...
@@ -5,7 +5,8 @@ namespace Drupal\simple_sitemap;
use
\
XMLWriter
;
/**
* SitemapGenerator class.
* Class SitemapGenerator
* @package Drupal\simple_sitemap
*/
class
SitemapGenerator
{
...
...
src/Tests/SimplesitemapTest.php
View file @
62b049f1
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment