在 SS 3.x 中,我们可以使用以下代码通过下拉菜单将自定义元素添加到HTMLEditorField
内容编辑器中。Styles
我的主要用途是将标准链接转换为样式按钮链接。
我们如何在 SS 4.x 中实现这一点?
这就是它在 3.x 中的完成方式
_config.php
<?php
$formats = array(
array(
'title' => 'Buttons'
),
array(
'title' => 'Custom Button',
'attributes' => array('class'=>'custom-btn'),
'selector' => 'a'
)
);
//Set the dropdown menu options
HtmlEditorConfig::get('cms')->setOption('style_formats',$formats);