You are here

protected function FBAutopostEvent::publishParameterPrepare in Facebook Autopost 7

Prepares the parameters to publish to Facebook, this means setting any field or destination dependent configuration.

Overrides FBAutopost::publishParameterPrepare

File

class/FBAutopostEvent.php, line 16
Class implementation for FBAutopostEvent

Class

FBAutopostEvent
Special case for publication type Event

Code

protected function publishParameterPrepare(&$publication) {
  parent::publishParameterPrepare($publication);
  $timezone = new DateTimeZone(variable_get('date_default_timezone', 'Europe/London'));
  if (is_numeric($publication['params']['start_time'])) {
    $start = new DateTime('@' . $publication['params']['start_time'], $timezone);
    $publication['params']['start_time'] = $start
      ->format(DateTime::ISO8601);
  }
  if (is_numeric($publication['params']['end_time'])) {
    $end = new DateTime('@' . $publication['params']['end_time'], $timezone);
    $publication['params']['end_time'] = $end
      ->format(DateTime::ISO8601);
  }
}