You are here

public function AddToCalendarApiWidget::__construct in Add To Calendar Button (AddEvent.com) 8.3

Same name and namespace in other branches
  1. 8.4 src/AddToCalendarApiWidget.php \Drupal\addtocalendar\AddToCalendarApiWidget::__construct()

Constructs a new AddToCalendarApiWidget object.

File

src/AddToCalendarApiWidget.php, line 120

Class

AddToCalendarApiWidget
Class AddToCalendarApiWidget.

Namespace

Drupal\addtocalendar

Code

public function __construct(ConfigFactoryInterface $config_factory) {
  $this->atcStyle = 'blue';
  $this->atcDisplayText = 'Add to calendar';
  $this->atcTitle = 'Some event title';
  $this->atcDescription = 'Some event description';
  $this->atcLocation = 'Some event location';

  // Fetching site name and site email id.
  $this->configFactory = $config_factory;
  $config = $this->configFactory
    ->getEditable('system.site');
  $site_name = $config
    ->get('name');
  $site_mail = $config
    ->get('mail');
  $this->atcOrganizer = $site_name;
  $this->atcOrganizerEmail = $site_mail;
  $this->atcDateStart = 'now';
  $this->atcDateEnd = 'now';
  $this->atcPrivacy = 'public';
  $this->atcDataSecure = 'auto';
  $data_calendars = [
    'iCalendar',
    'Google Calendar',
    'Outlook',
    'Outlook Online',
    'Yahoo! Calendar',
  ];
  $this->atcDataCalendars = $data_calendars;
  $this->timeZone = date_default_timezone_get();
}