[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Customize API: WP_Customize_Background_Position_Control class 4 * 5 * @package WordPress 6 * @subpackage Customize 7 * @since 4.7.0 8 */ 9 10 /** 11 * Customize Background Position Control class. 12 * 13 * @since 4.7.0 14 * 15 * @see WP_Customize_Control 16 */ 17 class WP_Customize_Background_Position_Control extends WP_Customize_Control { 18 19 /** 20 * Type. 21 * 22 * @since 4.7.0 23 * @var string 24 */ 25 public $type = 'background_position'; 26 27 /** 28 * Don't render the control content from PHP, as it's rendered via JS on load. 29 * 30 * @since 4.7.0 31 */ 32 public function render_content() {} 33 34 /** 35 * Render a JS template for the content of the position control. 36 * 37 * @since 4.7.0 38 */ 39 public function content_template() { 40 $options = array( 41 array( 42 'left top' => array( 43 'label' => __( 'Top Left' ), 44 'icon' => 'dashicons dashicons-arrow-left-alt', 45 ), 46 'center top' => array( 47 'label' => __( 'Top' ), 48 'icon' => 'dashicons dashicons-arrow-up-alt', 49 ), 50 'right top' => array( 51 'label' => __( 'Top Right' ), 52 'icon' => 'dashicons dashicons-arrow-right-alt', 53 ), 54 ), 55 array( 56 'left center' => array( 57 'label' => __( 'Left' ), 58 'icon' => 'dashicons dashicons-arrow-left-alt', 59 ), 60 'center center' => array( 61 'label' => __( 'Center' ), 62 'icon' => 'background-position-center-icon', 63 ), 64 'right center' => array( 65 'label' => __( 'Right' ), 66 'icon' => 'dashicons dashicons-arrow-right-alt', 67 ), 68 ), 69 array( 70 'left bottom' => array( 71 'label' => __( 'Bottom Left' ), 72 'icon' => 'dashicons dashicons-arrow-left-alt', 73 ), 74 'center bottom' => array( 75 'label' => __( 'Bottom' ), 76 'icon' => 'dashicons dashicons-arrow-down-alt', 77 ), 78 'right bottom' => array( 79 'label' => __( 'Bottom Right' ), 80 'icon' => 'dashicons dashicons-arrow-right-alt', 81 ), 82 ), 83 ); 84 ?> 85 <# if ( data.label ) { #> 86 <span class="customize-control-title">{{{ data.label }}}</span> 87 <# } #> 88 <# if ( data.description ) { #> 89 <span class="description customize-control-description">{{{ data.description }}}</span> 90 <# } #> 91 <div class="customize-control-content"> 92 <fieldset> 93 <legend class="screen-reader-text"><span> 94 <?php 95 /* translators: Hidden accessibility text. */ 96 _e( 'Image Position' ); 97 ?> 98 </span></legend> 99 <div class="background-position-control"> 100 <?php foreach ( $options as $group ) : ?> 101 <div class="button-group"> 102 <?php foreach ( $group as $value => $input ) : ?> 103 <label> 104 <input class="ui-helper-hidden-accessible" name="background-position" type="radio" value="<?php echo esc_attr( $value ); ?>"> 105 <span class="button display-options position"><span class="<?php echo esc_attr( $input['icon'] ); ?>" aria-hidden="true"></span></span> 106 <span class="screen-reader-text"><?php echo $input['label']; ?></span> 107 </label> 108 <?php endforeach; ?> 109 </div> 110 <?php endforeach; ?> 111 </div> 112 </fieldset> 113 </div> 114 <?php 115 } 116 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |