Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter to turn off background option on full layout #20

Merged
merged 2 commits into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ matrix:
env: WP_TRAVISCI=phpcs

- language: node_js
node_js: node
node_js: 9
env: WP_TRAVISCI=node

before_script:
Expand Down
38 changes: 21 additions & 17 deletions class-banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,25 +354,27 @@ public function get_fields(): array {
],
] );

$settings_tab[] = apply_filters( 'hogan/module/banner/acf/theme_on_full', [
'type' => 'true_false',
'key' => $this->field_key . 'theme_on_full',
'name' => 'theme_text_bg',
'label' => __( 'Content background', 'hogan-banner' ),
'instructions' => __( 'Use theme color as background for content?', 'hogan-banner' ),
'conditional_logic' => [
[
if ( true === apply_filters( 'hogan/module/banner/theme_on_full/enabled', true ) ) {
$settings_tab[] = apply_filters( 'hogan/module/banner/acf/theme_on_full', [
'type' => 'true_false',
'key' => $this->field_key . 'theme_on_full',
'name' => 'theme_text_bg',
'label' => __( 'Content background', 'hogan-banner' ),
'instructions' => __( 'Use theme color as background for content?', 'hogan-banner' ),
'conditional_logic' => [
[
'field' => $this->field_key . '_layout',
'operator' => '==',
'value' => 'full',
[
'field' => $this->field_key . '_layout',
'operator' => '==',
'value' => 'full',
],
],
],
],
'wrapper' => [
'width' => 50,
],
] );
'wrapper' => [
'width' => 50,
],
] );
}
}

/*
Expand Down Expand Up @@ -542,7 +544,9 @@ public function load_args_from_layout_content( array $raw_content, int $counter
$this->width = $raw_content['width'];
}

$this->theme_text_bg = ! $raw_content['theme_text_bg'];
if ( isset( $raw_content['theme_text_bg'] ) ) {
$this->theme_text_bg = ! $raw_content['theme_text_bg'];
}

// Main Image.
if ( ! empty( $raw_content['main_image_id'] ) ) {
Expand Down