Exemplo n.º 1
0
 private function _getWidth(Kwf_Component_Data $data, Kwf_Component_Data $child, $ownWidth)
 {
     $w = trim($child->row->width);
     if (substr($w, -2) == 'px') {
         $w = substr($w, 0, -2);
         //px abschneiden
     }
     if (is_numeric($w) && $w > 0) {
         //px (standard, wenn keine einheit)
         return (int) $w;
     }
     if (substr($w, -1) == '%' && substr($w, 0, -1) > 0) {
         $w = substr($w, 0, -1);
         $columns = $data->countChildComponents($data->getComponent()->getSelect());
         $ownWidth -= $this->_getSetting('contentMargin') * ($columns - 1);
         return (int) round($ownWidth * $w / 100);
     }
     return null;
     //unbekanntes format
 }