parent = $parent; $this->instance = $instance; } /** * @return array */ protected function get_image_size() { $sizes = genesis_get_image_sizes(); $options = array(); foreach ( (array) $sizes as $name => $size ) { $options[ $name ] = sprintf( '%s ( %s x %s )', esc_html( $name ), (int) $size['width'], (int) $size['height'] ); } return $options; } /** * @return array */ protected function get_image_alignment() { return array( 'alignnone' => __( 'None', 'display-featured-image-genesis' ), 'alignleft' => __( 'Left', 'display-featured-image-genesis' ), 'alignright' => __( 'Right', 'display-featured-image-genesis' ), 'aligncenter' => __( 'Center', 'display-featured-image-genesis' ), ); } /** * Get image fields (used in CPT and term). * * @return array */ public function get_image_fields() { return array( array( 'method' => 'checkbox', 'args' => array( 'id' => 'show_image', 'label' => __( 'Show Featured Image', 'display-featured-image-genesis' ), ), ), array( 'method' => 'select', 'args' => array( 'id' => 'image_size', 'label' => __( 'Image Size:', 'display-featured-image-genesis' ), 'flex' => true, 'choices' => $this->get_image_size(), ), ), array( 'method' => 'select', 'args' => array( 'id' => 'image_alignment', 'label' => __( 'Image Alignment', 'display-featured-image-genesis' ), 'flex' => true, 'choices' => $this->get_image_alignment(), ), ), ); } /** * Get the image fields for the author widget. * * @return array */ public function get_author_image_fields() { return array( array( 'method' => 'checkbox', 'args' => array( 'id' => 'show_featured_image', 'label' => __( 'Show the user\'s featured image.', 'display-featured-image-genesis' ), ), ), array( 'method' => 'select', 'args' => array( 'id' => 'featured_image_size', 'label' => __( 'Image Size:', 'display-featured-image-genesis' ), 'flex' => true, 'choices' => $this->get_image_size(), ), ), array( 'method' => 'select', 'args' => array( 'id' => 'featured_image_alignment', 'label' => __( 'Image Alignment:', 'display-featured-image-genesis' ), 'flex' => true, 'choices' => $this->get_image_alignment(), ), ), ); } /** * Get the text fields (used in CPT and term). * * @return array */ public function get_text_fields() { return array( array( 'method' => 'checkbox', 'args' => array( 'id' => 'show_title', 'label' => __( 'Show Term Title', 'display-featured-image-genesis' ), ), ), array( 'method' => 'checkbox', 'args' => array( 'id' => 'show_content', 'label' => __( 'Show Term Intro Text', 'display-featured-image-genesis' ), ), ), ); } /** * Build boxes with fields. * * @param $boxes * @param string $class */ public function do_boxes( $boxes, $class = '' ) { foreach ( $boxes as $box => $value ) { if ( ! $value ) { continue; } $box_class = ! $class ? 'genesis-widget-column-box' : 'genesis-widget-column-box ' . $class; printf( '