简体   繁体   English

将Bootstrap类名添加到Typo3表

[英]Add Bootstrap class-names to Typo3 tables

Is there a possibility to add Bootstrap table-classes to tables created in Typo3 v6.1? 是否有可能将Bootstrap表类添加到Typo3 v6.1中创建的表中? I have noticed the setting "Additional CSS Class" when creating a page of type "Table", but: 我在创建“Table”类型的页面时注意到了“Additional CSS Class”设置,但是:

  1. it doesn't add any classes to my table 它不会向我的表添加任何类
  2. it doesn't support adding multiple classes (commas, spaces etc. get stripped when saving) 它不支持添加多个类(逗号,空格等在保存时被剥离)

I would to add class="table table-hover" to any table I create. 我想将class="table table-hover"到我创建的任何表中。 Also, I don't think that I need the default class "contenttable". 另外,我认为我不需要默认类“contenttable”。

From your post, I assume that you are using the content element table, not a table in the RTE. 从您的帖子中,我假设您使用的是内容元素表,而不是RTE中的表。

Overriding the classes of the RTE would be easy (in TypoScript setup): 覆盖RTE的类很容易(在TypoScript设置中):

lib.parseFunc_RTE {
    externalBlocks {
        table.stdWrap.HTMLparser.tags.table.fixAttrib.class {
            default = table table-hover
            always = 1
            list >
        }
    }
}

(The TYPO3 default is "contenttable".) (TYPO3默认为“contenttable”。)

Overriding the classes of the table CE is harder. 覆盖表CE的类更难。 Only the FlexForm value is respected, if it is not set, it falls back to the standard classes, see https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/typo3/sysext/css_styled_content/Classes/Controller/CssStyledContentController.php#l130 仅限FlexForm值,如果未设置,则返回标准类,请参阅https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/typo3/sysext/css_styled_content /Classes/Controller/CssStyledContentController.php#l130

You will find two solutions in How to generate <table> compatible with jQueryMobile in TYPO3 . 您将在如何生成与TYPO3中的jQueryMobile兼容的<table>中找到两个解决方案。 The first one seems the best to me, the second one looks very hacky. 第一个看起来对我来说是最好的,第二个看起来非常h​​acky。

This has been fixed in the TYPO3 core, so you can use multiple classes in the regular table element now. 这已在TYPO3核心中修复,因此您现在可以在常规表元素中使用多个类。 See Bugfix #55470 on forge 请参阅伪造的修正号#55470

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM