class CalendarEvent in Calendar 8
Same name and namespace in other branches
- 8.2 src/CalendarEvent.php \Drupal\calendar\CalendarEvent
Defines a calendar event object.
Hierarchy
- class \Drupal\calendar\CalendarEvent
Expanded class hierarchy of CalendarEvent
1 file declares its use of CalendarEvent
- Calendar.php in src/
Plugin/ views/ row/ Calendar.php
File
- src/
CalendarEvent.php, line 10
Namespace
Drupal\calendarView source
class CalendarEvent {
/**
* The start date of the event.
*
* @var \DateTime
*/
protected $startDate;
/**
* The end date of the event.
*
* @var \DateTime
*/
protected $endDate;
/**
* The granularity of this event (e.g. "day", "second").
*
* @var string
*/
protected $granularity;
/**
* Defines whether or not this event's duration is all day.
*
* @var bool
*/
protected $allDay;
/**
* The timezone of the event.
*
* @var \DateTimeZone
*/
protected $timezone;
/**
* An array of the fields to render.
*
* @var array
*/
protected $renderedFields;
/**
* The array of labels to be used for this stripe option.
*
* @var array
*/
protected $stripeLabels;
/**
* The hex code array of the color to be used.
*
* @var string
*/
protected $stripeHexes;
/**
* Whether this event covers multiple days.
*
* @var bool
*/
protected $isMultiDay;
/**
* The content entity interface object.
*
* @var \Drupal\Core\Entity\ContentEntityInterface
*/
protected $entity;
/**
* CalendarEvent constructor.
*/
public function __construct(ContentEntityInterface $entity) {
$this->entity = $entity;
}
/**
* Getter for the entity id.
*
* @return intmixed
* The entity id.
*/
public function getEntityId() {
return $this->entity
->id();
}
/**
* Getter for the entity type id.
*
* @todo Remove for getType
*
* @return string
* The entity type id.
*/
public function getEntityTypeId() {
return $this->entity
->getEntityTypeId();
}
/**
* Function to get entity.
*
* @return \Drupal\Core\Entity\ContentEntityInterface
*/
public function getEntity() {
return $this->entity;
}
/**
* Getter for the type.
*
* @return string
* The type of the entity.
*/
public function getType() {
return $this->entity
->getEntityTypeId();
}
/**
* {@inheritDoc}
*/
public function getBundle() {
return $this->entity
->bundle();
}
/**
* Getter for the start date.
*
* @return \DateTime
* The start date.
*/
public function getStartDate() {
return $this->startDate;
}
/**
* Setter for the start date.
*
* @param \DateTime $startDate
* The start date.
*/
public function setStartDate($startDate) {
$this->startDate = $startDate;
}
/**
* Getter for the end date.
*
* @return \DateTime
* The end date.
*/
public function getEndDate() {
return $this->endDate;
}
/**
* Setter for the end date.
*
* @param \DateTime $endDate
* The end date.
*/
public function setEndDate($endDate) {
$this->endDate = $endDate;
}
/**
* Getter for the event granularity.
*
* @return string
* The event granularity.
*/
public function getGranularity() {
return $this->granularity;
}
/**
* Setter for the event granularity.
*
* @param string $granularity
* The event granularity.
*/
public function setGranularity($granularity) {
$this->granularity = $granularity;
}
/**
* Getter for the all day property.
*
* @return bool
* TRUE if the event is all day, FALSE otherwise.
*/
public function isAllDay() {
return $this->allDay;
}
/**
* Setter for the all day property.
*
* @param bool $allDay
* TRUE if the event is all day, FALSE otherwise.
*/
public function setAllDay($allDay) {
$this->allDay = $allDay;
}
/**
* Getter for the timezone property.
*
* @return \DateTimeZone
* The timezone of this event.
*/
public function getTimezone() {
return $this->timezone;
}
/**
* Setter for the timezone property.
*
* @param \DateTimeZone $timezone
* The timezone of this event.
*/
public function setTimezone($timezone) {
$this->timezone = $timezone;
}
/**
* The title getter.
*
* @return string
* The title of the event.
*/
public function getTitle() {
return $this->entity
->label();
}
/**
* Getter for the url.
*
* @return string
* The public url to this event.
*
* @throws \Drupal\Core\Entity\EntityMalformedException
*/
public function getUrl() {
return $this->entity
->toUrl();
}
/**
* Getter for the rendered fields array.
*
* @return array
* The rendered fields array.
*/
public function getRenderedFields() {
return $this->renderedFields;
}
/**
* Setter for the rendered fields array.
*
* @param array $renderedFields
* The rendered fields array.
*/
public function setRenderedFields(array $renderedFields) {
$this->renderedFields = $renderedFields;
}
/**
* Getter for the stripe label array.
*
* If no array is defined, this initializes the variable to an empty array.
*
* @return array
* The stripe labels.
*/
public function getStripeLabels() {
if (!isset($this->stripeLabels)) {
$this->stripeLabels = [];
}
return $this->stripeLabels;
}
/**
* Setter for the stripe label array.
*
* @param string $stripeLabels
* The stripe labels.
*/
public function setStripeLabels($stripeLabels) {
$this->stripeLabels = $stripeLabels;
}
/**
* Getter for the stripe hex code array.
*
* If no array is defined, this initializes the variable to an empty array.
*
* @return array
* The stripe hex code array.
*/
public function getStripeHexes() {
if (!isset($this->stripeHexes)) {
$this->stripeHexes = [];
}
return $this->stripeHexes;
}
/**
* The setter for the stripe hex code array.
*
* @param string $stripeHexes
* The stripe hex code array.
*/
public function setStripeHexes($stripeHexes) {
$this->stripeHexes = $stripeHexes;
}
/**
* Add a single strip hex.
*
* @param $stripeHex
*/
public function addStripeHex($stripeHex) {
$this->stripeHexes[] = $stripeHex;
}
/**
* Add a single strip label.
*
* @param $stripeLabel
*/
public function addStripeLabel($stripeLabel) {
$this->stripeLabels[] = $stripeLabel;
}
/**
* The getter which indicates whether an event covers multiple days.
*
* @return bool
*/
public function getIsMultiDay() {
return $this->isMultiDay;
}
/**
* The setter to indicate whether an event covers multiple days.
*/
public function setIsMultiDay($isMultiDay) {
$this->isMultiDay = $isMultiDay;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CalendarEvent:: |
protected | property | Defines whether or not this event's duration is all day. | |
CalendarEvent:: |
protected | property | The end date of the event. | |
CalendarEvent:: |
protected | property | The content entity interface object. | |
CalendarEvent:: |
protected | property | The granularity of this event (e.g. "day", "second"). | |
CalendarEvent:: |
protected | property | Whether this event covers multiple days. | |
CalendarEvent:: |
protected | property | An array of the fields to render. | |
CalendarEvent:: |
protected | property | The start date of the event. | |
CalendarEvent:: |
protected | property | The hex code array of the color to be used. | |
CalendarEvent:: |
protected | property | The array of labels to be used for this stripe option. | |
CalendarEvent:: |
protected | property | The timezone of the event. | |
CalendarEvent:: |
public | function | Add a single strip hex. | |
CalendarEvent:: |
public | function | Add a single strip label. | |
CalendarEvent:: |
public | function | ||
CalendarEvent:: |
public | function | Getter for the end date. | |
CalendarEvent:: |
public | function | Function to get entity. | |
CalendarEvent:: |
public | function | Getter for the entity id. | |
CalendarEvent:: |
public | function | Getter for the entity type id. | |
CalendarEvent:: |
public | function | Getter for the event granularity. | |
CalendarEvent:: |
public | function | The getter which indicates whether an event covers multiple days. | |
CalendarEvent:: |
public | function | Getter for the rendered fields array. | |
CalendarEvent:: |
public | function | Getter for the start date. | |
CalendarEvent:: |
public | function | Getter for the stripe hex code array. | |
CalendarEvent:: |
public | function | Getter for the stripe label array. | |
CalendarEvent:: |
public | function | Getter for the timezone property. | |
CalendarEvent:: |
public | function | The title getter. | |
CalendarEvent:: |
public | function | Getter for the type. | |
CalendarEvent:: |
public | function | Getter for the url. | |
CalendarEvent:: |
public | function | Getter for the all day property. | |
CalendarEvent:: |
public | function | Setter for the all day property. | |
CalendarEvent:: |
public | function | Setter for the end date. | |
CalendarEvent:: |
public | function | Setter for the event granularity. | |
CalendarEvent:: |
public | function | The setter to indicate whether an event covers multiple days. | |
CalendarEvent:: |
public | function | Setter for the rendered fields array. | |
CalendarEvent:: |
public | function | Setter for the start date. | |
CalendarEvent:: |
public | function | The setter for the stripe hex code array. | |
CalendarEvent:: |
public | function | Setter for the stripe label array. | |
CalendarEvent:: |
public | function | Setter for the timezone property. | |
CalendarEvent:: |
public | function | CalendarEvent constructor. |