PHP code example of flxlabs / silverstripe-pagesections

1. Go to this page and download the library: Download flxlabs/silverstripe-pagesections library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flxlabs / silverstripe-pagesections example snippets



class TextElement extends FLXLabs\PageSections\PageElement
{
  public static $singular_name = 'Text';
  public static $plural_name = 'Texts';

  private static $db = [
    'Content' => 'HTMLText',
  ];

  // Page elements can have other page elements as children.
  // Use this method to restrict allowed childre.
  public function getAllowedPageElements()
  {
    return [
      // YourElement::class
    ];
  }

  // This will be used to preview the content in the CMS editor
  public function getGridFieldPreview()
  {
      return $this->dbObject('Content')->Summary();
  }
}