| @@ -29,8 +29,44 @@ | ||
| 29 | 29 | 'overflow' => 'hidden', |
| 30 | 30 | ] |
| 31 | 31 | ); |
| 32 | 32 | |
| 33 | +if ( isset( $data['background_image'], $data['background_image']['url'] ) ) { | |
| 34 | + $background_image = $data['background_image']; | |
| 35 | + // Calculate background-position | |
| 36 | + $background_position = str_replace( '_', ' ', $background_image['position'] ); | |
| 37 | + if ( ! isset( $background_image['position'] ) || 'default' === $background_image['position'] ) { | |
| 38 | + $background_position = 'unset'; | |
| 39 | + } elseif ( 'custom' === $background_image['position'] ) { | |
| 40 | + $background_position = "{$background_image['x_position']}% {$background_image['y_position']}%"; | |
| 41 | + } | |
| 42 | + | |
| 43 | + // Calculate background-repeat | |
| 44 | + if ( ! isset( $background_image['repeat'] ) || 'default' === $background_image['repeat'] ) { | |
| 45 | + $background_repeat = 'unset'; | |
| 46 | + } else { | |
| 47 | + $background_repeat = $background_image['repeat']; | |
| 48 | + } | |
| 49 | + | |
| 50 | + // Calculate background-size | |
| 51 | + $background_size = $background_image['size']; | |
| 52 | + | |
| 53 | + if ( 'default' === $background_size ) { | |
| 54 | + $background_size = 'unset'; | |
| 55 | + } elseif ( 'custom' === $background_size ) { | |
| 56 | + $background_size = "{$background_image['custom_size']}%"; | |
| 57 | + } | |
| 58 | + | |
| 59 | + $wrapper_style .= TemplateHelpers::get_style( | |
| 60 | + [ | |
| 61 | + 'background-image' => "url({$background_image['url']})", | |
| 62 | + 'background-position' => $background_position, | |
| 63 | + 'background-repeat' => $background_repeat, | |
| 64 | + 'background-size' => $background_size, | |
| 65 | + ] | |
| 66 | + ); | |
| 67 | +}//end if | |
| 68 | + | |
| 33 | 69 | $inner_style = TemplateHelpers::get_style( |
| 34 | 70 | [ |
| 35 | 71 | 'width' => '100%', |
| 36 | 72 | 'overflow' => 'hidden', |