class YearMonthDate

Same name in this branch
  1. 9 core/modules/datetime/src/Plugin/views/argument/YearMonthDate.php \Drupal\datetime\Plugin\views\argument\YearMonthDate
Same name and namespace in other branches
  1. 11.x core/modules/views/src/Plugin/views/argument/YearMonthDate.php \Drupal\views\Plugin\views\argument\YearMonthDate
  2. 11.x core/modules/datetime/src/Plugin/views/argument/YearMonthDate.php \Drupal\datetime\Plugin\views\argument\YearMonthDate

Argument handler for a year plus month (CCYYMM)

Plugin annotation

@ViewsArgument("date_year_month");

Hierarchy

Expanded class hierarchy of YearMonthDate

1 string reference to 'YearMonthDate'
views.argument.schema.yml in core/modules/views/config/schema/views.argument.schema.yml
core/modules/views/config/schema/views.argument.schema.yml

File

core/modules/views/src/Plugin/views/argument/YearMonthDate.php, line 10

Namespace

Drupal\views\Plugin\views\argument
View source
class YearMonthDate extends Date {
  
  /**
   * {@inheritdoc}
   */
  protected $format = 'F Y';
  
  /**
   * {@inheritdoc}
   */
  protected $argFormat = 'Ym';
  
  /**
   * {@inheritdoc}
   */
  public function summaryName($data) {
    $created = $data->{$this->name_alias};
    return $this->dateFormatter
      ->format(strtotime($created . "15" . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
  }
  
  /**
   * {@inheritdoc}
   */
  public function title() {
    return $this->dateFormatter
      ->format(strtotime($this->argument . "15" . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.