| Conditions | 1 |
| Paths | 1 |
| Total Lines | 106 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 82 | protected function content_template() { |
||
| 83 | ?> |
||
| 84 | <label> |
||
| 85 | <span class="customize-control-title"> |
||
| 86 | {{{ data.label }}} |
||
| 87 | </span> |
||
| 88 | <# if ( data.description ) { #> |
||
| 89 | <span class="description customize-control-description">{{{ data.description }}}</span> |
||
| 90 | <# } #> |
||
| 91 | </label> |
||
| 92 | <div class="background-wrapper"> |
||
| 93 | |||
| 94 | <!-- background-color --> |
||
| 95 | <div class="background-color"> |
||
| 96 | <h4>{{ data.l10n['background-color'] }}</h4> |
||
| 97 | <input type="text" data-default-color="{{ data.default['background-color'] }}" value="{{ data.value['background-color'] }}" class="kirki-color-control color-picker" {{{ data.link }}} /> |
||
| 98 | </div> |
||
| 99 | |||
| 100 | <!-- background-image --> |
||
| 101 | <div class="background-image"> |
||
| 102 | <h4>{{ data.l10n['background-image'] }}</h4> |
||
| 103 | <div class="attachment-media-view background-image-upload"> |
||
| 104 | <# if ( data.value['background-image'] ) { #> |
||
| 105 | <div class="thumbnail thumbnail-image"> |
||
| 106 | <img src="{{ data.value['background-image'] }}" alt="" /> |
||
| 107 | </div> |
||
| 108 | <# } else { #> |
||
| 109 | <div class="placeholder"> |
||
| 110 | {{ data.l10n['no-file-selected'] }} |
||
| 111 | </div> |
||
| 112 | <# } #> |
||
| 113 | <div class="actions"> |
||
| 114 | <button class="button background-image-upload-remove-button<# if ( ! data.value['background-image'] ) { #> hidden <# } #>"> |
||
| 115 | {{ data.l10n['remove'] }} |
||
| 116 | </button> |
||
| 117 | <button type="button" class="button background-image-upload-button"> |
||
| 118 | {{ data.l10n['select-file'] }} |
||
| 119 | </button> |
||
| 120 | </div> |
||
| 121 | </div> |
||
| 122 | </div> |
||
| 123 | |||
| 124 | <!-- background-repeat --> |
||
| 125 | <div class="background-repeat"> |
||
| 126 | <h4>{{ data.l10n['background-repeat'] }}</h4> |
||
| 127 | <# |
||
| 128 | var repeats = [ |
||
| 129 | 'no-repeat', |
||
| 130 | 'repeat-all', |
||
| 131 | 'repeat-x', |
||
| 132 | 'repeat-y' |
||
| 133 | ]; |
||
| 134 | #> |
||
| 135 | <select {{{ data.inputAttrs }}} {{{ data.link }}}> |
||
| 136 | <# _.each( repeats, function( repeat ) { #> |
||
| 137 | <option value="{{ repeat }}"<# if ( repeat === data.value['background-repeat'] ) { #> selected <# } #>>{{ data.l10n[ repeat ] }}</option> |
||
| 138 | <# }); #> |
||
| 139 | </select> |
||
| 140 | </div> |
||
| 141 | |||
| 142 | <!-- background-size --> |
||
| 143 | <div class="background-size"> |
||
| 144 | <h4>{{ data.l10n['background-size'] }}</h4> |
||
| 145 | <# |
||
| 146 | var sizes = [ |
||
| 147 | 'cover', |
||
| 148 | 'contain', |
||
| 149 | 'auto' |
||
| 150 | ]; |
||
| 151 | #> |
||
| 152 | <select {{{ data.inputAttrs }}} {{{ data.link }}}> |
||
| 153 | <# _.each( sizes, function( size ) { #> |
||
| 154 | <option value="{{ size }}"<# if ( size === data.value['background-size'] ) { #> selected <# } #>>{{ data.l10n[ size ] }}</option> |
||
| 155 | <# }); #> |
||
| 156 | </select> |
||
| 157 | </div> |
||
| 158 | |||
| 159 | <!-- background-attachment --> |
||
| 160 | <!-- <div class="background-attachment"> |
||
| 161 | <h4>{{ data.l10n['background-attachment'] }}</h4> |
||
| 162 | </div> --> |
||
| 163 | |||
| 164 | <!-- background-position --> |
||
| 165 | <div class="background-position"> |
||
| 166 | <h4>{{ data.l10n['background-position'] }}</h4> |
||
| 167 | <# |
||
| 168 | var positions = [ |
||
| 169 | 'left top', |
||
| 170 | 'left center', |
||
| 171 | 'left bottom', |
||
| 172 | 'right top', |
||
| 173 | 'right center', |
||
| 174 | 'right bottom', |
||
| 175 | 'center top', |
||
| 176 | 'center center', |
||
| 177 | 'center bottom' |
||
| 178 | ]; |
||
| 179 | #> |
||
| 180 | <select {{{ data.inputAttrs }}} {{{ data.link }}}> |
||
| 181 | <# _.each( positions, function( position ) { #> |
||
| 182 | <option value="{{ position }}"<# if ( position === data.value['background-position'] ) { #> selected <# } #>>{{ data.l10n[ position ] }}</option> |
||
| 183 | <# }); #> |
||
| 184 | </select> |
||
| 185 | </div> |
||
| 186 | <?php |
||
| 187 | } |
||
| 188 | |||
| 236 |