gorriecoe/silverstripe-sreg

简单的标记化器,允许您在数据对象字符串中使用类似 .ss 模板变量。

安装: 132

依赖项: 0

建议者: 0

安全: 0

星标: 1

关注者: 3

分支: 1

公开问题: 0

类型:silverstripe-vendormodule

1.2.2 2018-05-03 04:06 UTC

This package is auto-updated.

Last update: 2024-08-29 04:06:11 UTC


README

简单的标记化器,允许您在数据对象字符串中使用类似 .ss 模板变量。

安装

Composer 是安装 SilverStripe 模块推荐的方式。

composer require gorriecoe/silverstripe-sreg

要求

  • silverstripe/framework ^4.0

维护者

用法

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