Exemplo n.º 1
0
 /**
  */
 private function generate_style_property()
 {
     if ($this->__style_property__) {
         // determine value to set
         if ($this instanceof ICE_Option_Attachment_Image) {
             $value = $this->get_image_url('full');
         } elseif ($this instanceof ICE_Option_Static_Image) {
             $value = $this->get_image_url();
         } else {
             $value = $this->get();
         }
         // try to set the value
         if (null !== $value && $this->__style_property__->set_value($value, $this->style_unit)) {
             // get the style value
             $style_value = $this->__style_property__->get_value();
             // add value to component styles if set
             if ($style_value->has_value()) {
                 if ($this->style_section) {
                     $rule = $this->style()->section($this->style_section)->rule($this->format_style_selector());
                 } else {
                     $rule = $this->style()->rule($this->format_style_selector());
                 }
                 $rule->add_declaration($this->__style_property__->get_name(), $this->__style_property__->get_value()->format());
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Constructor
  *
  * @param string $name Name of the property to create
  * @param ICE_Stack $primitives Stack of primitive properties which make up this composite
  */
 public function __construct($name, ICE_Stack $primitives)
 {
     throw new Exception('Composite style properties are not yet fully supported!');
     parent::__construct($name);
     foreach ($primitives as $primitive) {
         if ($primitive instanceof ICE_Style_Property_Primitive) {
             $this->properties[$primitive->name] = $primitive;
         } else {
             throw new Exception('Only primitive properties can be added to a composite property');
         }
     }
 }