2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-embed

image

gorriecoe/silverstripe-embed

  • Tuesday, July 10, 2018
  • by gorriecoe
  • Repository
  • 1 Watchers
  • 0 Stars
  • 59 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 181 % Grown

The README.md

Silverstripe embed

ko-fi, (*1)

Adds embed and video a dataobject along with dataextension to apply embed to existing objects., (*2)

Installation

Composer is the recommended way of installing SilverStripe modules., (*3)

composer require gorriecoe/silverstripe-embed

Requirements

  • silverstripe/framework ^4.0

Maintainers

Usage

Relationship to Embed Dataobjects, (*4)

use gorriecoe\Embed\Models\Embed;

class ClassName extends DataObject
{
    private static $has_one = [
        'Embed' => Embed::class,
        'Video' => Video::class
    ];

    public function getCMSFields()
    {
        ...
        $fields->addFieldsToTab(
            'Main',
            [
                HasOneButtonField::create(
                    'Embed',
                    'Embed',
                    $this
                ),
                HasOneButtonField::create(
                    'Video',
                    'Video',
                    $this
                )
            ]
        );
        ...
    }
}

Update current DataObject to be Embeddable with DataExtension, (*5)

use gorriecoe\Embed\Extensions\Embeddable;

class ClassName extends DataObject
{
    private static $extensions = [
        Embeddable::class,
    ];

    /**
     * List the allowed included embed types.  If null all are allowed.
     * @var array
     */
    private static $allowed_embed_types = [
        'video',
        'photo'
    ];

    /**
     * Defines tab to insert the embed fields into.
     * @var string
     */
    private static $embed_tab = 'Main';
}

The Versions