Skip to content

gorriecoe/silverstripe-sreg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silverstripe sreg

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}');
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages