LeKoala\Blocks\Block
The block dataobject is used to actually store the data
Synopsis
class Block
extends DataObject
{
- // constants
- const ITEMS_KEY = 'Items';
- const DATA_KEY = 'BlockData';
- const SETTINGS_KEY = 'Settings';
- // members
- private static string $table_name = 'Block';
- private static array $db = ;
- private static array $has_one = ;
- private static array $many_many = ;
- private static array $many_many_extraFields = ;
- private static array $cascade_deletes = ;
- private static array $owns = ;
- private static array $summary_fields = ;
- private static array $translate = ;
- private static array $defaults = ;
- private static string $default_sort = 'Sort ASC';
- public static boolean $auto_update_page = true;
- // methods
- public void forTemplate()
- public void getTitle()
- public DataList Collection()
- public DataList SharedCollection()
- public ManyManyList SortedImages()
- public ManyManyList SortedFiles()
- public string renderWithTemplate()
- public string Cls()
- protected static ArrayList normalizeIndexedList()
- public Image ImageByID()
- public static Image getPublishedImageByID()
- public static File getPublishedFileByID()
- public boolean isInAdmin()
- public void onBeforeWrite()
- public void onAfterWrite()
- public string BlockType()
- public static string getClassWithoutNamespace()
- public void BlockClass()
- public mixed __get()
- public mixed hasField()
- public static array extractNameParts()
- public string getIn()
- public $this setCastedField()
- public array DataArray()
- public array SettingsArray()
- public string getClass()
- public BaseBlock getTypeInstance()
- public DBHTMLText Summary()
- public void getCMSActions()
- public void getCMSFields()
- public int getNextSort()
- public void validate()
- public static array listBlocks()
- public static void listValidTypes()
- public static void listTemplates()
- protected static string getBlockName()
- public string getFolderName()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Tasks
Line | Task |
---|---|
691 | let injector do the job? |
Constants
Name | Value |
---|---|
ITEMS_KEY | 'Items' |
DATA_KEY | 'BlockData' |
SETTINGS_KEY | 'Settings' |
Members
private
- $cascade_deletes
- $db
- $default_sort
- $defaults
- $has_one
- $many_many
- $many_many_extraFields
- $owns
- $summary_fields
- $table_name
- $translate
public
- $auto_update_page
—
boolean
Should we update the page after block update Turn this off when updating all blocks of a page otherwise it's really slow
Methods
protected
- getBlockName() — Get a more human readable name TODO: i18n
- normalizeIndexedList() — Convert an indexed array to an ArrayList This allows loops, etc in the template
public
- BlockClass() — Get unqualified class of the block's type
- BlockType() — Get a name for this type Basically calling getBlockName with the Type
- Cls() — Class helper to use in your templates
- Collection() — Each block type can have one "collection" of items
- DataArray() — Consistently returns an array regardless of what is in BlockData
- ImageByID() — Template helper to access images
- SettingsArray() — Consistently returns an array regardless of what is in Settings
- SortedFiles() — Get sorted files
- SortedImages() — Get sorted images
- Summary() — Returns a summary to be displayed in the gridfield
- __get() — Extend __get to allow loading data from Data store
- extractNameParts() — Split Name[Input][Sub][Value] notation
- forTemplate()
- getCMSActions()
- getCMSFields()
- getClass() — When looping in template, wrap the blocks content is wrapped in a div with theses classes
- getClassWithoutNamespace() — Get a class name without namespace
- getFolderName() — The place where to store assets We create a folder for each record to easily clean up after deletion
- getIn() — Get nested data
- getNextSort() — This allows you to define your own method if needed Like when you have page dependent data objects that shouldn't use a global sort Or if you want to sort by a given multiple to allow inserts later on
- getPublishedFileByID() — Make sure the file is published for the block
- getPublishedImageByID() — Make sure the image is published for the block
- getTitle()
- getTypeInstance() — Get a viewable block instance wrapping this block
- hasField() — Extend hasField to allow loading data from Data store
- isInAdmin()
- listBlocks() — List all classes extending BaseBlock
- listTemplates() — Get a list of blocks mapped by unqualified class => class
- listValidTypes() — Get a list of blocks mapped by class => name
- onAfterWrite()
- onBeforeWrite()
- renderWithTemplate() — This is called onBeforeWrite and renders content in order to store it in Content variable
- setCastedField() — Hijack setCastedField to ensure form saving works properly
- validate()