You are here

class YearMonthDate in Drupal 10

Same name in this branch
  1. 10 core/modules/views/src/Plugin/views/argument/YearMonthDate.php \Drupal\views\Plugin\views\argument\YearMonthDate
  2. 10 core/modules/datetime/src/Plugin/views/argument/YearMonthDate.php \Drupal\datetime\Plugin\views\argument\YearMonthDate
Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/argument/YearMonthDate.php \Drupal\views\Plugin\views\argument\YearMonthDate
  2. 9 core/modules/views/src/Plugin/views/argument/YearMonthDate.php \Drupal\views\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');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Date::$dateFormatter protected property The date formatter service.
Date::$option_name public property
Date::$routeMatch protected property The route match.
Date::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
Date::defaultArgumentForm public function Add an option to set the default value to the current date.
Date::getDefaultArgument public function Set the empty argument value to the current date, formatted appropriately for this argument.
Date::getFormula public function Overrides Formula::getFormula
Date::getSortName public function
Date::__construct public function Constructs a new Date instance. 1
Formula::$formula public property
Formula::init public function
Formula::query public function Build the query based upon the formula.
Formula::summaryQuery protected function Build the summary query based on a formula.
YearMonthDate::$argFormat protected property The date format used in the query. Overrides Date::$argFormat
YearMonthDate::$format protected property The date format used in the title. Overrides Date::$format
YearMonthDate::summaryName public function
YearMonthDate::title public function