UI system for rapid adding/editing of any number of (sub-)records
This is the code documentation for the SproutCMS project
Search documentation |
class MultiEditUI system for rapid adding/editing of any number of (sub-)records
Example$images = MultiEdit::load('gallery_images', ['gallery_id' => $gallery_id], 'record_order'); MultiEdit::itemName('Image'); MultiEdit::reorder(); MultiEdit::setPostAddJavaScriptFunc('load_thumbnails'); MultiEdit::display('images', $images, @$_SESSION['gallery']['field_errors']['multiedit_images']); Extending this class<?php /** * New class description goes here * * @author Your Name, 2024-11-24 **/ class NewClassName extends MultiEdit { /** * Displays a multiedit field **/ public function display (string $key, array|null $data, array $errors) { // Method code goes here } /** * Returns true if the multiedit record is empty, false otherwise **/ public function recordEmpty (array $record, array $defaults) { // Method code goes here } /** * Set the item name for a multiedit. * e.g. 'image' **/ public function itemName ($item_name) { // Method code goes here } /** * Set the name of a javascript function to call after each multiedit item is added * * The JavaScript function is called with the following arguments: * $div jQuery element for the outer div * data Array of field data OR null for a new record * idx The record index **/ public function setPostAddJavaScriptFunc (string $function_name) { // Method code goes here } /** * Enable multiedit reordering **/ public function reorder () { // Method code goes here } /** * Returns an array of data, which should be put into a view, and passed into MultiEdit::display. **/ public function load (string $table, array $where, string|array $order) { // Method code goes here } } ?> |
Powered by Pelzini, version 0.9.0 |
Documentation is made available under the
GNU Free Documentation License 1.2. Generated: Monday, 3rd April, 2023 at 02:59 pm |