method setEvent documentation in bbn\Appui\Cms

Inserts in bbn_events and bbn_notes_events the information relative to the publication of the given note.

function(string $id_note, array $cfg = []) { if (!array_key_exists('start', $cfg)) { throw new Exception(X::_("A start date is mandatory for CMS event (even null)")); } if (empty($cfg['start'])) { return $this->unpublish($id_note); } if (!($note = $this->note->get($id_note))) { throw new Exception(X::_("The note %s does not exist", $id_note)); } if (!$this->_check_date($cfg['start'], $cfg['end'] ?? null)) { throw new Exception(X::_("The dates don't work... End before start?")); } if (empty($this->getEvent($id_note))) { $fields = $this->class_cfg['arch']['events']; //if a type is not given it inserts the event as page if ($id_event = $this->event->insert([ $fields['name'] => $note['title'] ?? '', $fields['id_type'] => $cfg['id_type'] ?? self::$_id_event ?? null, $fields['start'] => $cfg['start'], $fields['end'] => $cfg['end'] ?? null ]) ) { if ($res = $this->note->insertNoteEvent($id_note, $id_event)) { $this->cacheDelete($id_note); } return $res; } else { X::log([ $fields['name'] => $note['title'] ?? '', $fields['id_type'] => $cfg['id_type'] ?? self::$_id_event ?? null, $fields['start'] => $cfg['start'], $fields['end'] => $cfg['end'] ?? null ], 'cmsss'); throw new Exception(X::_("Impossible to insert the event")); } } else if ($this->updateEvent($id_note, $cfg)) { $this->cacheDelete($id_note); return true; } return null; }

Inserts in bbn_events and bbn_notes_events the information relative to the publication of the given note. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.