\Snippet
Synopsis
class Snippet
extends DataObject
{
- // members
- private static array $db = ;
- private static array $has_one = ;
- private static array $has_many = ;
- private static array $extensions = ;
- private static string $default_sort = 'Title, ID';
- private static array $allowed_children = ;
- private static $default_child = NULL;
- // methods
- public {bool} canView()
- public {bool} canEdit()
- public {bool} canDelete()
- public {bool} canCreate()
- public void requireTable()
- public {FieldList} getCMSFields()
- public {RequiredFields} getCMSValidator()
- protected void onBeforeWrite()
- protected void onAfterWrite()
- protected void onBeforeDelete()
- public {SnippetVersion} getCurrentVersion()
- public {string} getCurrentVersionID()
- public {string} getSnippetText()
- public {SnippetVersion} Version()
- public {string} getBrushName()
- public {string} getHighlightCode()
- public {array} summaryFields()
- public string getTreeTitle()
- public {bool} hasSnippets()
- public {string} CMSTreeClasses()
- public {array} allowedChildren()
- public {string} default_child()
Hierarchy
Extends
- DataObject
Members
private
- $allowed_children
- $db
- $default_child
- $default_sort
- $extensions
- $has_many
- $has_one
Methods
protected
- onAfterWrite() — Creates the snippet version record after writing
- onBeforeDelete() — Removes all version history for this snippet before deleting the snippet record
- onBeforeWrite() — Sets the creator id for new snippets and sets the last editor id for existing snippets
public
- CMSTreeClasses() — Return the CSS classes to apply to this node in the CMS tree
- Version() — Gets the version by its id
- allowedChildren() — Returns an array of the class names of classes that are allowed to be children of this class.
- canCreate() — Checks to see if the member can create or not
- canDelete() — Checks to see if the member can delete or not
- canEdit() — Checks to see if the member can edit or not
- canView() — Checks to see if the member can view or not
- default_child() — Returns the default child for this class
- getBrushName() — Gets the brush name
- getCMSFields() — Gets fields used in the cms
- getCMSValidator() — Gets validator used in the cms
- getCurrentVersion() — Gets the current version
- getCurrentVersionID() — Gets the id from the latest snippet version
- getHighlightCode() — Gets the highlight code used for syntax highlighter
- getSnippetText() — Gets the text from the latest snippet version
- getTreeTitle() — Returns two <span> html DOM elements, an empty <span> with the class 'jstree-pageicon' in front, following by a <span> wrapping around its Title.
- hasSnippets() — Workaround to get snippets to display
- requireTable() — Check the database schema and update it as necessary.
- summaryFields() — Gets the summary fields used in gridfield