Dotclear

Changeset 3827:9f0c774b0866


Ignore:
Timestamp:
08/27/18 09:16:04 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Extends opts to each type of widget setting (only 'class' is taken into account up to now)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/widgets/class.widgets.php

    r3825 r3827  
    274274                return false; 
    275275            } 
    276         } elseif ($type == 'textarea') { 
    277             // If any, the 4th argument should be an array (key → value) 
    278             $options = @func_get_arg(4); 
     276            // If any, the 5th argument should be an array (key → value) of opts 
     277            $opts = @func_get_arg(5); 
     278        } else { 
     279            // If any, the 4th argument should be an array (key → value) of opts 
     280            $opts = @func_get_arg(4); 
    279281        } 
    280282 
     
    288290            $this->settings[$name]['options'] = $options; 
    289291        } 
     292        if (isset($opt)) { 
     293            $this->settings[$name]['opts'] = $opts; 
     294        } 
    290295    } 
    291296 
     
    311316        $wfid  = "wf-" . $i; 
    312317        $iname = $pr ? $pr . '[' . $id . ']' : $id; 
     318        $class = (isset($s['opts']) && isset($s['opts']['class']) ? ' ' . $s['opts']['class'] : ''); 
    313319        switch ($s['type']) { 
    314320            case 'text': 
    315321                $res .= 
    316322                '<p><label for="' . $wfid . '">' . $s['title'] . '</label> ' . 
    317                 form::field(array($iname, $wfid), 20, 255, html::escapeHTML($s['value']), 'maximal') . 
     323                form::field(array($iname, $wfid), 20, 255, html::escapeHTML($s['value']), 'maximal' . $class) . 
    318324                    '</p>'; 
    319325                break; 
    320326            case 'textarea': 
    321                 $class = (isset($s['options']) && isset($s['options']['class']) ? ' ' . $s['options']['class'] : ''); 
    322327                $res .= 
    323328                '<p><label for="' . $wfid . '">' . $s['title'] . '</label> ' . 
     
    329334                '<p>' . form::hidden(array($iname), '0') . 
    330335                '<label class="classic" for="' . $wfid . '">' . 
    331                 form::checkbox(array($iname, $wfid), '1', $s['value']) . ' ' . $s['title'] . 
     336                form::checkbox(array($iname, $wfid), '1', $s['value'], $class) . ' ' . $s['title'] . 
    332337                    '</label></p>'; 
    333338                break; 
     
    339344                        $res .= 
    340345                        '<label class="classic" for="' . $wfid . '-' . $k . '">' . 
    341                         form::radio(array($iname, $wfid . '-' . $k), $v[1], $s['value'] == $v[1]) . ' ' . $v[0] . 
     346                        form::radio(array($iname, $wfid . '-' . $k), $v[1], $s['value'] == $v[1], $class) . ' ' . $v[0] . 
    342347                            '</label>'; 
    343348                    } 
     
    348353                $res .= 
    349354                '<p><label for="' . $wfid . '">' . $s['title'] . '</label> ' . 
    350                 form::combo(array($iname, $wfid), $s['options'], $s['value']) . 
     355                form::combo(array($iname, $wfid), $s['options'], $s['value'], $class) . 
    351356                    '</p>'; 
    352357                break; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map