xref: /template/strap/ComboStrap/Opacity.php (revision 37748cd8654635afbeca80942126742f0f4cc346)
1*37748cd8SNickeau<?php
2*37748cd8SNickeau
3*37748cd8SNickeau
4*37748cd8SNickeaunamespace ComboStrap;
5*37748cd8SNickeau
6*37748cd8SNickeau
7*37748cd8SNickeauclass Opacity
8*37748cd8SNickeau{
9*37748cd8SNickeau
10*37748cd8SNickeau    const OPACITY_ATTRIBUTE = "opacity";
11*37748cd8SNickeau
12*37748cd8SNickeau    /**
13*37748cd8SNickeau     * Set the opacity
14*37748cd8SNickeau     *
15*37748cd8SNickeau     * For a background image, the opacity is set on the {@link Background::processBackgroundAttributes()}
16*37748cd8SNickeau     * Because the image background parameters are in array, it seems
17*37748cd8SNickeau     * that they are not interfering
18*37748cd8SNickeau     *
19*37748cd8SNickeau     * @param TagAttributes $tagAttributes
20*37748cd8SNickeau     */
21*37748cd8SNickeau    public static function processOpacityAttribute(TagAttributes &$tagAttributes){
22*37748cd8SNickeau
23*37748cd8SNickeau        if ($tagAttributes->hasComponentAttribute(self::OPACITY_ATTRIBUTE)) {
24*37748cd8SNickeau            $value = $tagAttributes->getValueAndRemove(self::OPACITY_ATTRIBUTE);
25*37748cd8SNickeau            $tagAttributes->addStyleDeclaration("opacity",$value);
26*37748cd8SNickeau        }
27*37748cd8SNickeau
28*37748cd8SNickeau    }
29*37748cd8SNickeau
30*37748cd8SNickeau
31*37748cd8SNickeau}
32