xref: /plugin/combo/ComboStrap/Opacity.php (revision 04fd306c7c155fa133ebb3669986875d65988276)
137748cd8SNickeau<?php
237748cd8SNickeau
337748cd8SNickeau
437748cd8SNickeaunamespace ComboStrap;
537748cd8SNickeau
637748cd8SNickeau
7*04fd306cSNickeauuse ComboStrap\TagAttribute\BackgroundAttribute;
8*04fd306cSNickeau
937748cd8SNickeauclass Opacity
1037748cd8SNickeau{
1137748cd8SNickeau
1237748cd8SNickeau    const OPACITY_ATTRIBUTE = "opacity";
1337748cd8SNickeau
1437748cd8SNickeau    /**
1537748cd8SNickeau     * Set the opacity
1637748cd8SNickeau     *
17*04fd306cSNickeau     * For a background image, the opacity is set on the {@link BackgroundAttribute::processBackgroundAttributes()}
1837748cd8SNickeau     * Because the image background parameters are in array, it seems
1937748cd8SNickeau     * that they are not interfering
2037748cd8SNickeau     *
2137748cd8SNickeau     * @param TagAttributes $tagAttributes
2237748cd8SNickeau     */
2337748cd8SNickeau    public static function processOpacityAttribute(TagAttributes &$tagAttributes){
2437748cd8SNickeau
2537748cd8SNickeau        if ($tagAttributes->hasComponentAttribute(self::OPACITY_ATTRIBUTE)) {
2637748cd8SNickeau            $value = $tagAttributes->getValueAndRemove(self::OPACITY_ATTRIBUTE);
2782a60d03SNickeau            $tagAttributes->addStyleDeclarationIfNotSet("opacity",$value);
2837748cd8SNickeau        }
2937748cd8SNickeau
3037748cd8SNickeau    }
3137748cd8SNickeau
3237748cd8SNickeau
3337748cd8SNickeau}
34