| Conditions | 1 |
| Paths | 1 |
| Total Lines | 81 |
| Code Lines | 55 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 182 | function lsx_customizer_template_cover_controls( $lsx_controls ) { |
||
| 183 | $lsx_controls['sections']['lsx-cover-template'] = array( |
||
| 184 | 'title' => esc_html__( 'Cover Template Settings', 'lsx' ), |
||
| 185 | 'description' => esc_html__( 'Change the cover template settings.', 'lsx' ), |
||
| 186 | 'priority' => 23, |
||
| 187 | ); |
||
| 188 | |||
| 189 | $lsx_controls['settings']['lsx_cover_template_fixed_background'] = array( |
||
| 190 | 'default' => '1', |
||
| 191 | 'sanitize_callback' => 'lsx_sanitize_checkbox', |
||
| 192 | 'transport' => 'postMessage', |
||
| 193 | ); |
||
| 194 | |||
| 195 | $lsx_controls['fields']['lsx_cover_template_fixed_background'] = array( |
||
| 196 | 'label' => esc_html__( 'Fixed Background Image', 'lsx' ), |
||
| 197 | 'section' => 'lsx-cover-template', |
||
| 198 | 'type' => 'checkbox', |
||
| 199 | ); |
||
| 200 | |||
| 201 | $lsx_controls['settings']['lsx_cover_template_overlay_background_color'] = array( |
||
| 202 | 'default' => '#000000', |
||
| 203 | 'sanitize_callback' => 'sanitize_hex_color', |
||
| 204 | 'type' => 'theme_mod', |
||
| 205 | 'transport' => 'postMessage', |
||
| 206 | ); |
||
| 207 | |||
| 208 | $lsx_controls['fields']['lsx_cover_template_overlay_background_color'] = array( |
||
| 209 | 'label' => esc_html__( 'Overlay Background Color', 'lsx' ), |
||
| 210 | 'description' => __( 'The color used for the overlay. Defaults to black.', 'lsx' ), |
||
| 211 | 'section' => 'lsx-cover-template', |
||
| 212 | 'control' => 'WP_Customize_Color_Control', |
||
| 213 | ); |
||
| 214 | |||
| 215 | $lsx_controls['settings']['lsx_cover_template_overlay_text_color'] = array( |
||
| 216 | 'default' => '#ffffff', |
||
| 217 | 'sanitize_callback' => 'sanitize_hex_color', |
||
| 218 | 'type' => 'theme_mod', |
||
| 219 | 'transport' => 'postMessage', |
||
| 220 | ); |
||
| 221 | |||
| 222 | $lsx_controls['fields']['lsx_cover_template_overlay_text_color'] = ( |
||
| 223 | array( |
||
| 224 | 'label' => __( 'Overlay Text Color', 'lsx' ), |
||
| 225 | 'description' => __( 'The color used for the text in the overlay.', 'lsx' ), |
||
| 226 | 'section' => 'lsx-cover-template', |
||
| 227 | 'control' => 'WP_Customize_Color_Control', |
||
| 228 | ) |
||
| 229 | ); |
||
| 230 | |||
| 231 | $lsx_controls['settings']['lsx_cover_template_menu_text_color'] = array( |
||
| 232 | 'default' => '#ffffff', |
||
| 233 | 'sanitize_callback' => 'sanitize_hex_color', |
||
| 234 | 'type' => 'theme_mod', |
||
| 235 | 'transport' => 'postMessage', |
||
| 236 | ); |
||
| 237 | |||
| 238 | $lsx_controls['fields']['lsx_cover_template_menu_text_color'] = ( |
||
| 239 | array( |
||
| 240 | 'label' => __( 'Menu Text Color', 'lsx' ), |
||
| 241 | 'description' => __( 'The color used for the text in the nav menu.', 'lsx' ), |
||
| 242 | 'section' => 'lsx-cover-template', |
||
| 243 | 'control' => 'WP_Customize_Color_Control', |
||
| 244 | ) |
||
| 245 | ); |
||
| 246 | |||
| 247 | $lsx_controls['settings']['lsx_cover_template_overlay_opacity'] = array( |
||
| 248 | 'default' => 80, |
||
| 249 | 'sanitize_callback' => 'absint', |
||
| 250 | 'transport' => 'postMessage', |
||
| 251 | ); |
||
| 252 | |||
| 253 | $lsx_controls['fields']['lsx_cover_template_overlay_opacity'] = ( |
||
| 254 | array( |
||
| 255 | 'label' => __( 'Overlay Opacity', 'lsx' ), |
||
| 256 | 'description' => __( 'Make sure that the contrast is high enough so that the text is readable.', 'lsx' ), |
||
| 257 | 'section' => 'lsx-cover-template', |
||
| 258 | 'type' => 'range', |
||
| 259 | ) |
||
| 260 | ); |
||
| 261 | |||
| 262 | return $lsx_controls; |
||
| 263 | } |
||
| 289 |