gorriecoe/silverstripe-sreg

Simple tokenizer that allows you to use .ss template like variables in a dataobjects string.

Installs: 132

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 1

Open Issues: 0

Type:silverstripe-vendormodule

1.2.2 2018-05-03 04:06 UTC

This package is auto-updated.

Last update: 2024-11-29 04:52:23 UTC


README

Simple tokenizer that allows you to use .ss template like variables in a dataobjects string.

Installation

Composer is the recommended way of installing SilverStripe modules.

composer require gorriecoe/silverstripe-sreg

Requirements

  • silverstripe/framework ^4.0

Maintainers

Usage

class MyObject extends DataObject
{
    private static $has_one = [
        'Relation' => 'SomeObject',
        'AFallBack' => 'SomeObject',
    ];

    public function SomeFunction()
    {
        return 'Some text';
    }

    public function getValue()
    {
        return $this->sreg('Lorem ipsum {$Relation.Title|AFallBack.Title|Fall back text} {$SomeFunction}');
    }
}