method update documentation in bbn\Appui\Note

function(string $id, $title, string $content = '', bool $private = false, bool $locked = false, string $excerpt = '', bool $pinned = false) { $title, string $content = '', bool $private = false, bool $locked = false, string $excerpt = '', bool $pinned = false ): ?int { $props = [ 'title', 'content', 'private', 'locked', 'excerpt', 'pinned' ]; if (is_array($title)) { $cfg = $title; } else { $cfg = []; } foreach ($props as $prop) { if (!array_key_exists($prop, $cfg)) { $cfg[$prop] = $$prop; } } if (empty($cfg['content']) && empty($cfg['title'])) { return null; } $ok = null; if ($old = $this->get($id)) { $ok = 0; $new_note = []; $new_version = []; foreach ($props as $p) { if ($cfg[$p] != $old[$p]) { if (in_array($p, ['content', 'title', 'excerpt'])) { $new_version[$p] = $cfg[$p]; } else { $new_note[$p] = $cfg[$p]; } } } if (!empty($new_note)) { $ok = $this->db->update('bbn_notes', $new_note, ['id' => $id]); } if (!empty($new_version)) { $ok = $this->insertVersion($id, $cfg['title'], $cfg['content'], $cfg['excerpt']); } } return $ok; }

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.