\CodeBlock
CodeBlocks are containers of arbitary markup, text or script that can be 'embedded' in page content via TinyMCE using its custom tinymce toolbar widget.
Use the "advertfortinymce" tinymce plugin to select a CodeBlock in the CMS and insert it as a shortcode into your content.
This is then translated into an image placeholder and parsed when the page is rendered and replaced with the contents of the
'Content' text field from the CodeBlock DataObject.
Shortcodes are translated for tinymce into an <img> element, so users can't edit the shortcode itself,
but in the database they look like this: [codeblock id={CodeBlock.ID}]CodeBlock.Name[/codeblock]
- Author: Michael Parkhill <mike@silverstripe.com>
Synopsis
class CodeBlock
extends DataObject
{
- // members
- private static array $db = ;
- private static array $summary_fields = ;
- // methods
- public FieldList getCMSFields()
- public static mixed codeblock_shortcode_handler()
Hierarchy
Extends
- DataObject
Members
private
- $db — array
- $summary_fields — array
Methods
public
- codeblock_shortcode_handler() — Shortcode parser callback to replace "[codeblock id=n]CodeBlock Name[/codeblock]" with CodeBlock.Content contents Note: any content passed in via the $content parameter will be ignored.
- getCMSFields()