SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class MultiEdit

UI 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']);

Variables

NameVisibilityDescription
$item_name (static) 
$post_add_func (static) 
$reorder (static) 

Functions

NameVisibilityDescription
displaypublic (static)Displays a multiedit field
itemNamepublic (static)Set the item name for a multiedit.
loadpublic (static)Returns an array of data, which should be put into a view, and passed into MultiEdit::display.
recordEmptypublic (static)Returns true if the multiedit record is empty, false otherwise
reorderpublic (static)Enable multiedit reordering
setPostAddJavaScriptFuncpublic (static)Set the name of a javascript function to call after each multiedit item is added

public display

void MultiEdit::display ( string $key , array|null $data , array $errors );

Displays a multiedit field

public itemName

void MultiEdit::itemName ( mixed $item_name );

Set the item name for a multiedit.
e.g. 'image'

public load

array MultiEdit::load ( string $table , array $where [, string|array $order ] );

Returns an array of data, which should be put into a view, and passed into MultiEdit::display.

public recordEmpty

boolean MultiEdit::recordEmpty ( array $record , array $defaults );

Returns true if the multiedit record is empty, false otherwise

public reorder

void MultiEdit::reorder ( );

Enable multiedit reordering

public setPostAddJavaScriptFunc

void MultiEdit::setPostAddJavaScriptFunc ( string $function_name );

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