YearMonthDate.php

Contains \Drupal\views\Plugin\views\argument\YearMonthDate.

Namespace

Drupal\views\Plugin\views\argument

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/argument/YearMonthDate.php
View source
<?php

/**
 * @file
 * Contains \Drupal\views\Plugin\views\argument\YearMonthDate.
 */
namespace Drupal\views\Plugin\views\argument;

use Drupal\Component\Annotation\PluginID;

/**
 * Argument handler for a year plus month (CCYYMM)
 *
 * @PluginID("date_year_month")
 */
class YearMonthDate extends Date {

  /**
   * {@inheritdoc}
   */
  protected $format = 'F Y';

  /**
   * {@inheritdoc}
   */
  protected $argFormat = 'Ym';

  /**
   * Provide a link to the next level of the view
   */
  public function summaryName($data) {
    $created = $data->{$this->name_alias};
    return format_date(strtotime($created . "15" . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
  }

  /**
   * Provide a link to the next level of the view
   */
  function title() {
    return format_date(strtotime($this->argument . "15" . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
  }

}

Classes

Namesort descending Description
YearMonthDate Argument handler for a year plus month (CCYYMM)