| 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 |
||
| 93 | protected function content_template() { |
||
| 94 | ?> |
||
| 95 | <# if ( data.label ) { #><span class="customize-control-title">{{ data.label }}</span><# } #> |
||
| 96 | <# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #> |
||
| 97 | <div class="icons-wrapper"> |
||
| 98 | <# if ( ! _.isUndefined( data.choices ) && 1 < _.size( data.choices ) ) { #> |
||
| 99 | <# for ( key in data.choices ) { #> |
||
| 100 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ key }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( data.value === key ) { #> checked="checked"<# } #>> |
||
| 101 | <label for="{{ data.id }}{{ key }}"><span class="dashicons dashicons-{{ data.choices[ key ] }}"></span></label> |
||
| 102 | </input> |
||
| 103 | <# } #> |
||
| 104 | <# } else { #> |
||
| 105 | <h4>Admin Menu</h4> |
||
| 106 | <# for ( key in data.icons['admin-menu'] ) { #> |
||
| 107 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['admin-menu'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['admin-menu'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['admin-menu'][ key ] ) { #> checked="checked"<# } #>> |
||
| 108 | <label for="{{ data.id }}{{ data.icons['admin-menu'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['admin-menu'][ key ] }}"></span></label> |
||
| 109 | </input> |
||
| 110 | <# } #> |
||
| 111 | <h4>Welcome Screen</h4> |
||
| 112 | <# for ( key in data.icons['welcome-screen'] ) { #> |
||
| 113 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['welcome-screen'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['welcome-screen'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['welcome-screen'][ key ] ) { #> checked="checked"<# } #>> |
||
| 114 | <label for="{{ data.id }}{{ data.icons['welcome-screen'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['welcome-screen'][ key ] }}"></span></label> |
||
| 115 | </input> |
||
| 116 | <# } #> |
||
| 117 | <h4>Post Formats</h4> |
||
| 118 | <# for ( key in data.icons['post-formats'] ) { #> |
||
| 119 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['post-formats'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['post-formats'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['post-formats'][ key ] ) { #> checked="checked"<# } #>> |
||
| 120 | <label for="{{ data.id }}{{ data.icons['post-formats'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['post-formats'][ key ] }}"></span></label> |
||
| 121 | </input> |
||
| 122 | <# } #> |
||
| 123 | <h4>Media</h4> |
||
| 124 | <# for ( key in data.icons['media'] ) { #> |
||
| 125 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['media'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['media'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['media'][ key ] ) { #> checked="checked"<# } #>> |
||
| 126 | <label for="{{ data.id }}{{ data.icons['media'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['media'][ key ] }}"></span></label> |
||
| 127 | </input> |
||
| 128 | <# } #> |
||
| 129 | <h4>Image Editing</h4> |
||
| 130 | <# for ( key in data.icons['image-editing'] ) { #> |
||
| 131 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['image-editing'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['image-editing'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['image-editing'][ key ] ) { #> checked="checked"<# } #>> |
||
| 132 | <label for="{{ data.id }}{{ data.icons['image-editing'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['image-editing'][ key ] }}"></span></label> |
||
| 133 | </input> |
||
| 134 | <# } #> |
||
| 135 | <h4>TinyMCE</h4> |
||
| 136 | <# for ( key in data.icons['tinymce'] ) { #> |
||
| 137 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['tinymce'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['tinymce'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['tinymce'][ key ] ) { #> checked="checked"<# } #>> |
||
| 138 | <label for="{{ data.id }}{{ data.icons['tinymce'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['tinymce'][ key ] }}"></span></label> |
||
| 139 | </input> |
||
| 140 | <# } #> |
||
| 141 | <h4>Posts</h4> |
||
| 142 | <# for ( key in data.icons['posts'] ) { #> |
||
| 143 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['posts'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['posts'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['posts'][ key ] ) { #> checked="checked"<# } #>> |
||
| 144 | <label for="{{ data.id }}{{ data.icons['posts'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['posts'][ key ] }}"></span></label> |
||
| 145 | </input> |
||
| 146 | <# } #> |
||
| 147 | <h4>Sorting</h4> |
||
| 148 | <# for ( key in data.icons['sorting'] ) { #> |
||
| 149 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['sorting'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['sorting'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['sorting'][ key ] ) { #> checked="checked"<# } #>> |
||
| 150 | <label for="{{ data.id }}{{ data.icons['sorting'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['sorting'][ key ] }}"></span></label> |
||
| 151 | </input> |
||
| 152 | <# } #> |
||
| 153 | <h4>Social</h4> |
||
| 154 | <# for ( key in data.icons['social'] ) { #> |
||
| 155 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['social'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['social'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['social'][ key ] ) { #> checked="checked"<# } #>> |
||
| 156 | <label for="{{ data.id }}{{ data.icons['social'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['social'][ key ] }}"></span></label> |
||
| 157 | </input> |
||
| 158 | <# } #> |
||
| 159 | <h4>WordPress</h4> |
||
| 160 | <# for ( key in data.icons['wordpress_org'] ) { #> |
||
| 161 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['wordpress_org'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['wordpress_org'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['wordpress_org'][ key ] ) { #> checked="checked"<# } #>> |
||
| 162 | <label for="{{ data.id }}{{ data.icons['wordpress_org'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['wordpress_org'][ key ] }}"></span></label> |
||
| 163 | </input> |
||
| 164 | <# } #> |
||
| 165 | <h4>Products</h4> |
||
| 166 | <# for ( key in data.icons['products'] ) { #> |
||
| 167 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['products'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['products'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['products'][ key ] ) { #> checked="checked"<# } #>> |
||
| 168 | <label for="{{ data.id }}{{ data.icons['products'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['products'][ key ] }}"></span></label> |
||
| 169 | </input> |
||
| 170 | <# } #> |
||
| 171 | <h4>Taxonomies</h4> |
||
| 172 | <# for ( key in data.icons['taxonomies'] ) { #> |
||
| 173 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['taxonomies'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['taxonomies'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['taxonomies'][ key ] ) { #> checked="checked"<# } #>> |
||
| 174 | <label for="{{ data.id }}{{ data.icons['taxonomies'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['taxonomies'][ key ] }}"></span></label> |
||
| 175 | </input> |
||
| 176 | <# } #> |
||
| 177 | <h4>Widgets</h4> |
||
| 178 | <# for ( key in data.icons['widgets'] ) { #> |
||
| 179 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['widgets'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['widgets'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['widgets'][ key ] ) { #> checked="checked"<# } #>> |
||
| 180 | <label for="{{ data.id }}{{ data.icons['widgets'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['widgets'][ key ] }}"></span></label> |
||
| 181 | </input> |
||
| 182 | <# } #> |
||
| 183 | <h4>Notifications</h4> |
||
| 184 | <# for ( key in data.icons['notifications'] ) { #> |
||
| 185 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['notifications'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['notifications'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['notifications'][ key ] ) { #> checked="checked"<# } #>> |
||
| 186 | <label for="{{ data.id }}{{ data.icons['notifications'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['notifications'][ key ] }}"></span></label> |
||
| 187 | </input> |
||
| 188 | <# } #> |
||
| 189 | <h4>Misc</h4> |
||
| 190 | <# for ( key in data.icons['misc'] ) { #> |
||
| 191 | <input {{{ data.inputAttrs }}} class="dashicons-select" type="radio" value="{{ data.icons['misc'][ key ] }}" name="_customize-dashicons-radio-{{ data.id }}" id="{{ data.id }}{{ data.icons['misc'][ key ] }}" {{{ data.link }}}<# if ( data.value === data.icons['misc'][ key ] ) { #> checked="checked"<# } #>> |
||
| 192 | <label for="{{ data.id }}{{ data.icons['misc'][ key ] }}"><span class="dashicons dashicons-{{ data.icons['misc'][ key ] }}"></span></label> |
||
| 193 | </input> |
||
| 194 | <# } #> |
||
| 195 | <# } #> |
||
| 196 | </div> |
||
| 197 | <?php |
||
| 198 | } |
||
| 199 | } |
||
| 200 |