/** * Add multiple events * * @param array|ArrayAccess $events * @param array $customAttributes * @return $this */ public function addEvents($events, array $customAttributes = []) { foreach ($events as $event) { $this->eventCollection->push($event, $customAttributes); } return $this; }
/** * Get options+events JSON * * @return string */ public function getOptionsJson() { $options = $this->getOptions(); $placeholders = $this->getCallbackPlaceholders(); $parameters = array_merge($options, $placeholders); $parameters['events'] = $this->eventCollection->toArray(); $json = json_encode($parameters); if ($placeholders) { return $this->replaceCallbackPlaceholders($json, $placeholders); } return $json; }
/** * Get options+events JSON * * @return string */ public function getOptionsJson() { $options = $this->getOptions(); $placeholders = $this->getCallbackPlaceholders(); $parameters = array_merge($options, $placeholders); // Allow the user to override the events list with a url if (!isset($parameters['events'])) { $parameters['events'] = $this->eventCollection->toArray(); } $json = json_encode($parameters); if ($placeholders) { return $this->replaceCallbackPlaceholders($json, $placeholders); } return $json; }