NodeType.php 965 Bytes
Newer Older
1
2
3
<?php
/**
 * @file
Pawel G's avatar
Pawel G committed
4
 * Contains \Drupal\simple_sitemap\Plugin\LinkGenerator\NodeType.
5
 *
Pawel G's avatar
Pawel G committed
6
 * Plugin for node entity link generation.
7
8
 */

Pawel G's avatar
Pawel G committed
9
namespace Drupal\simple_sitemap\Plugin\LinkGenerator;
10

Pawel G's avatar
Pawel G committed
11
12
use Drupal\simple_sitemap\Annotation\LinkGenerator;
use Drupal\simple_sitemap\LinkGeneratorBase;
13
14
15
16
17
18
19
20
21
22
23
24
25

/**
 * NodeType class.
 *
 * @LinkGenerator(
 *   id = "node_type"
 * )
 */
class NodeType extends LinkGeneratorBase {

  /**
   * {@inheritdoc}
   */
26
27
  public function getInfo() {
    return array(
Pawel G's avatar
Pawel G committed
28
29
30
31
32
33
34
35
36
      'field_info' => array(
        'entity_id' => 'nid',
        'lastmod' => 'changed',
      ),
      'path_info' => array(
        'route_name' => 'entity.node.canonical',
        'entity_type' => 'node',
      )
    );
37
  }
38
39
40
41
42

  /**
   * {@inheritdoc}
   */
  public function getQuery($bundle) {
43
    return $this->database->select('node_field_data', 'n')
44
45
46
47
48
      ->fields('n', array('nid', 'changed'))
      ->condition('type', $bundle)
      ->condition('status', 1);
  }

49
}