ru-se.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

CssClassBoxesControl.php (1768B)


      1 <?php
      2 
      3 namespace Materialis\Customizer\Controls;
      4 
      5 class CssClassBoxesControl extends ColorBoxesControl
      6 {
      7     public function init()
      8     {
      9         $this->type = 'radio';
     10         $this->cpData['bigPreview'] = isset($this->cpData['bigPreview']) && $this->cpData['bigPreview'];
     11     }
     12 
     13 
     14     public function render()
     15     {
     16         $id    = 'customize-control-' . str_replace(array( '[', ']' ), array( '-', '' ), $this->id);
     17         $class = 'customize-control customize-control-' . $this->type; ?>
     18 
     19         <li id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($class); ?> cp-color-boxes">
     20 			<?php $this->render_content(); ?>
     21 		</li>
     22         <?php
     23 
     24     }
     25 
     26 
     27     public function render_content()
     28     {
     29         if (empty($this->choices)) {
     30             return;
     31         }
     32 
     33         $name = '_customize-radio-' . $this->id;
     34 
     35         if (! empty($this->label)) : ?>
     36 		    <span class="customize-control-title"><?php echo esc_html($this->label); ?></span>
     37 		<?php endif;
     38         if (! empty($this->description)) : ?>
     39 			<span class="description customize-control-description"><?php echo $this->description ; ?></span>
     40 		<?php endif;
     41 
     42         foreach ($this->choices as $value) : ?>
     43             <label title="<?php echo esc_attr($value); ?>">
     44                 <div class="css-class-container <?php echo $value; ?>">
     45                 <input type="radio" class="<?php echo ($this->cpData['bigPreview']?"big":"") ?>" value="<?php echo esc_attr($value); ?>"
     46                     name="<?php echo esc_attr($name); ?>" <?php $this->link();
     47         checked($this->value(), $value); ?> />
     48                  <span class="check-icon"></span>
     49                 </div>
     50             </label>
     51             <?php
     52         endforeach;
     53     }
     54 }