SproutCMS

This is the code documentation for the SproutCMS project

class Itemlist

Used to generate HTML for a table of database records.
This is usually used for the admin/contents/* route which provides the main
UI to operators for a given ManagedAdminController

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-04-27
**/
class NewClassName extends Itemlist {
    
    /**
    * Does the parameter replacements on an action url
    * 
    * Replaces %% with the id of the record.
    **/
    private function urlReplace ($url, $item) {
        // Method code goes here
    }
    
    /**
    * Renders an itemlist definition
    * 
    * Definition can be one of:
    *  - A field name
    *  - An array with two indexes, 0 =&gt; ColModifier, 1 =&gt; field name
    *  - A Closure, which will receive one argument of the entire row as an array,
    *    and must return a string of HTML
    * 
    * The Closure result supports a subset of HTML, {@see Text::limitedSubsetHtml} for more details
    **/
    protected function renderItem (mixed $defn, array|object $item_data) {
        // Method code goes here
    }
    
    /**
    * Does this itemlist support ordering?
    **/
    public function setOrdering ($ordering) {
        // Method code goes here
    }
    
    /**
    * Does this itemlist support checkboxes?
    **/
    public function setCheckboxes ($checkboxes) {
        // Method code goes here
    }
    
    /**
    * Calculate the result of an aggregation
    **/
    protected function calculateAggregateColumn (string $operation, array $values) {
        // Method code goes here
    }
    
    /**
    * Add an aggregate which is just a single pre-computed value
    **/
    public function addAggregateValue (string $title, string $value) {
        // Method code goes here
    }
    
    /**
    * Add an aggregate which operates on the values of a column
    **/
    public function addAggregateColumn (string $title, string $operation, ColModifier $modifier) {
        // Method code goes here
    }
    
    /**
    * Set a function which should return content for the actions column
    * The func should have this signature:
    * 
    *    string function mycallable(array $row)
    * 
    * The return value should be HTML with the links
    **/
    public function setActionsFunc ($func) {
        // Method code goes here
    }
    
    /**
    * Set a function which should return the classes to use on the row.
    * 
    *    string function mycallable(array $row)
    * 
    * The return value should be a string of class names
    **/
    public function setRowClassesFunc (callable $func) {
        // Method code goes here
    }
    
    /**
    * Adds an action to this itemlist.
    * 
    * The special action 'edit' is used when the row is clicked.
    **/
    public function addAction (string $name, string $url, string $classes, callable $show_func) {
        // Method code goes here
    }
    
    /**
    * Set link classes common for all actions
    * The default is &quot;actions--link&quot;.
    **/
    public function setActionsClasses (string $classes) {
        // Method code goes here
    }
    
    public function __toString () {
        // Method code goes here
    }
    
    public function render () {
        // Method code goes here
    }
    
}
?>