Refactor settings fields/sections

This commit is contained in:
Robin Cornett
2019-05-12 17:40:05 -04:00
parent 0489695e64
commit 562fedf8c7
7 changed files with 308 additions and 321 deletions
+47
View File
@@ -0,0 +1,47 @@
<?php
$fields = array(
array(
'id' => 'skip',
'title' => __( 'Skip Content Types', 'display-featured-image-genesis' ),
'callback' => 'do_checkbox_array',
'section' => 'cpt_sitewide',
'options' => $this->get_post_types(),
'skip' => true,
),
array(
'id' => 'fallback',
'title' => __( 'Prefer Fallback Images', 'display-featured-image-genesis' ),
'callback' => 'do_checkbox_array',
'section' => 'cpt_sitewide',
'options' => $this->get_post_types(),
'description' => __( 'Select content types which should always use a fallback image, even if a featured image has been set.', 'display-featured-image-genesis' ),
'skip' => true,
),
array(
'id' => 'large',
'title' => __( 'Force Large Images', 'display-featured-image-genesis' ),
'callback' => 'do_checkbox_array',
'section' => 'cpt_sitewide',
'options' => $this->get_post_types(),
'description' => __( 'Select content types which should always prefer to use the large image size instead of the backstretch, even if a backstretch size image is available (singular posts/pages, not archives).', 'display-featured-image-genesis' ),
'skip' => true,
),
);
$custom_pages = array(
'search' => __( 'Search Results', 'display-featured-image-genesis' ),
'fourohfour' => __( '404 Page', 'display-featured-image-genesis' ),
);
$post_types = array_merge( $custom_pages, $this->get_post_types() );
foreach ( $post_types as $post_type => $label ) {
$fields[] = array(
'id' => esc_attr( $post_type ),
'title' => esc_attr( $label ),
'callback' => 'set_cpt_image',
'section' => 'cpt',
'type' => 'image',
);
}
return $fields;