Example #1
0
 /**
  * parse array params
  */
 protected function parseArrayParams()
 {
     foreach ($this->params as $i => $param) {
         if (Column::isParsable($param)) {
             $this->row = new Row(array(new Column($param)));
         }
     }
 }
Example #2
0
 public function testRenderWithStyle()
 {
     $column = new Column();
     $column->addStyleAttribute('color:red');
     $html = $column->render();
     $expected = array('tag' => 'div', 'attributes' => array('class' => 'col-sm-12', 'style' => 'color:red'));
     $this->assertTag($expected, $html);
 }
Example #3
0
 /**
  * parse array params
  * @return $this for method chain
  */
 protected function parseArrayParams()
 {
     $init_type = false;
     foreach ($this->params as $param) {
         $param = trim($param);
         switch ($param) {
             case 'default':
             case 'primary':
             case 'success':
             case 'info':
             case 'warning':
             case 'danger':
                 if (!$init_type) {
                     $this->type = $param;
                     $init_type = true;
                 }
                 break;
             default:
                 if (Column::isParsable($param)) {
                     $this->row = new Row(array(new Column($param)));
                 }
         }
     }
 }
Example #4
0
 protected function parseHashParams()
 {
     $set_buttons = null;
     foreach ($this->params as $key => $value) {
         $enabled = null;
         if (is_bool($value)) {
             $enabled = $value;
         } else {
             if (is_string($value)) {
                 $value = trim($value);
                 $enabled = !in_array($value, ['disabled', 'none']);
             }
         }
         switch ($key) {
             case 'buttons':
                 if ($enabled) {
                     $this->options['indicatorsSet'] = $this->options['controlsSet'] = true;
                 } else {
                     $this->options['indicatorsSet'] = $this->options['controlsSet'] = false;
                 }
                 $set_buttons = true;
                 break;
             case 'indicator':
                 if ($set_buttons) {
                     break;
                 }
                 if ($enabled) {
                     $this->options['indicatorsSet'] = true;
                 } else {
                     $this->options['indicatorsSet'] = false;
                 }
                 break;
             case 'slidebuttons':
             case 'controls':
                 if ($set_buttons) {
                     break;
                 }
                 if ($enabled) {
                     $this->options['controlsSet'] = true;
                 } else {
                     $this->options['controlsSet'] = false;
                 }
                 break;
             case 'span':
                 if (Column::isParsable($value)) {
                     $this->row = new Row(array(new Column($value)));
                 }
         }
     }
 }
Example #5
0
 protected function columnIsParsable($text)
 {
     return Column::isParsable($text);
 }