简体   繁体   English

使用 Bootstrap_package 为 Typo3 中的内容元素添加多个额外的预定义背景颜色

[英]Add multiple additional predefined background colours for content elements in Typo3 with Bootstrap_package

I tried to add new predefined background colours according to the instructions for the bootstrap_package我尝试根据 bootstrap_package 的说明添加新的预定义背景颜色

https://github.com/benjaminkott/bootstrap_package/wiki/Add-additional-Background-Colors-to-Content-Elements https://github.com/benjaminkott/bootstrap_package/wiki/Add-additional-Background-Colors-to-Content-Elements

It works fine with only one additional colour, adding the code from the instructions to PageTsConfig and TypoScript constants (the SCSS snippet seems to be not necessary).它只需要一种额外的颜色就可以正常工作,将指令中的代码添加到 PageTsConfig 和 TypoScript 常量(SCSS 片段似乎不是必需的)。 However, I'm not able to make it work with more than one colour.但是,我无法使它与一种以上的颜色一起使用。 The pageTsConfig part seems to work (I see all the new colors as option in the backend editor). pageTsConfig 部分似乎有效(我在后端编辑器中看到所有新的 colors 作为选项)。

TCEFORM {
    tt_content {
        background_color_class {
            addItems {
                red = Red
                white = White
                hblau = Herth-Blau
            }
        }
    }
}

But the change in the CSS (through the constants of the extension) does not work.但是 CSS 中的更改(通过扩展的常量)不起作用。 I tried this code there:我在那里尝试了这段代码:

plugin.bootstrap_package.settings.scss {
    frame-backgrounds = ( hblau:(background: #0092d0, link-color: #e0efff, link-hover-color: #ffffff),
                          white:(background: #ffffff, link-color: #e0efff, link-hover-color: #ffffff),
                          red:(background: #ff0000, link-color: #ffeeee, link-hover-color: #ffffff)
     )
} 

Does any body else have an idea, what I'm doing wrong here?有没有其他人有想法,我在这里做错了什么?

Any help highly appreciated.任何帮助高度赞赏。

kind regards Chris亲切的问候克里斯

As you are writing TypoScript code, you are using the assignment operator "=" and you have to write all the values within the same line;在编写 TypoScript 代码时,您正在使用赋值运算符“=”,并且必须在同一行中写入所有值; I'll borrow some lines from the official documentation我会从官方文档中借一些台词

Value assignment: The “=” operator赋值:“=”运算符

This simply assigns a value to an object path.这只是为 object 路径分配一个值。

Rules:规则:

Everything after the = sign and up to the end of the line is considered to be the value. = 符号之后直到行尾的所有内容都被认为是值。 > In other words: You don't need to quote anything! > 换句话说:你不需要引用任何东西!

Be aware that the value will be trimmed, which means stripped of whitespace at both ends请注意,该值将被修剪,这意味着在两端去除空白

Example:例子:

myObject.myProperty = value 2

If you want to use multiline values, you have to use the "()" operator and write如果要使用多行值,则必须使用“()”运算符并编写

  • the opening parenthesis on the same line of the object object 同一行的左括号
  • the value assigned on a new line (or multiple lines)在新行(或多行)上分配的值
  • and the closing parenthesis on new line和新行上的右括号

Multi-line values: The ( ) signs Opening and closing parenthesis are used to assign a multi-line value.多行值: ( ) 符号左括号和右括号用于分配多行值。 With this method you can define values which span several lines and thus include line breaks.使用此方法,您可以定义跨越多行的值,从而包括换行符。

Important重要的

You cannot use multi-line values in constants.您不能在常量中使用多行值。 They are only available in the setup part of TypoScript.它们仅在 TypoScript 的设置部分可用。

Example例子

myObject = TEXT
myObject.value (
   <p class="warning">
     This is HTML code.
   </p>
)

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

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