[英]OctoberCMS icons selection in Builder
Your question is not precise enough. 你的问题不够准确。 Do you need this list in a back-end form? 您是否需要以后端形式列出此列表?
If so, you can create a partial in which you will put your custom code to create and fill your dropdown 如果是这样,您可以创建一个部分,您可以在其中设置自定义代码并填充下拉列表
https://octobercms.com/docs/backend/forms#field-partial https://octobercms.com/docs/backend/forms#field-partial
Just for someone with the same question, this is simple, here is an example of how to do that: 对于有相同问题的人来说,这很简单,这是一个如何做到这一点的例子:
fields:
icon:
label: Icon
type: dropdown
span: left
options:
'oc-icon-adjust': ['adjust', 'oc-icon-adjust'],
'oc-icon-adn': ['adn', 'oc-icon-adn'],
'oc-icon-align-center': ['align-center', 'oc-icon-align-center'],
'oc-icon-align-justify': ['align-justify', 'oc-icon-align-justify']
public function getIconOptions
{
return [
'oc-icon-adjust' => ['adjust', 'oc-icon-adjust'],
'oc-icon-adn' => ['adn', 'oc-icon-adn'],
'oc-icon-align-center' => ['align-center', 'oc-icon-align-center'],
'oc-icon-align-justify' => ['align-justify', 'oc-icon-align-justify']
];
}
Reference : 参考 :
https://github.com/rainlab/builder-plugin/blob/master/classes/IconList.php https://github.com/rainlab/builder-plugin/blob/master/classes/IconList.php
fields:
icon:
label: Icon
type: dropdown
span: left
commentHtml: true
comment: '<link rel="stylesheet" type="text/css" href="/themes/themename/assets/css/font-custom.css" media="all"/>'
options:
tm-accesories: ['accesories', 'tm tm-accesories']
tm-smartphone: ['smartphone', 'tm tm-smartphone']
tm-shopping-bag: ['shopping-bag', 'tm tm-shopping-bag']
tm-grid: ['grid', 'tm tm-grid']
tm-best-brands: ['best-brands', 'tm tm-best-brands']
There's a plugin now that adds support of backend form widget with icons list: plugin page . 现在有一个插件,它增加了对后端表单小部件的支持,带有图标列表: 插件页面 。 The form widget it provides is even better than the original form the builder. 它提供的表单小部件甚至比构建器的原始形式更好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.