Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
PLANET-4348 fix en-form climate emergency logo not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
dpivo committed Oct 29, 2019
1 parent 1741b7b commit 3b8eed4
Show file tree
Hide file tree
Showing 20 changed files with 145 additions and 27 deletions.
22 changes: 21 additions & 1 deletion classes/blocks/class-enform.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ public function add_block_shortcode( $attributes, $content ) {
* @return array The data to be passed in the View.
*/
public function prepare_data( $attributes ): array {
global $pagenow;

global $post;

// Enqueue js for the frontend.
if ( ! $this->is_rest_request() ) {
Expand Down Expand Up @@ -248,13 +249,32 @@ public function prepare_data( $attributes ): array {
$rendered_form = '';
}

$campaign_data = array();

if ( 'campaign' === get_post_type() && isset( $attributes['campaign_logo'] ) ) {
if ( 'true' == $attributes['campaign_logo'] ) {
$page_meta_data = get_post_meta( $post->ID );
$campaign_template = ! empty( $page_meta_data['_campaign_page_template'][0] ) ? $page_meta_data['_campaign_page_template'][0] : false;

if ( $campaign_template ) {
$campaign_logo_path = get_bloginfo( 'template_directory' ) . '/images/' . $campaign_template . '/logo-light.png';
$campaign_data = [
'template' => $campaign_template,
'logo_path' => $campaign_logo_path,
'logo' => $attributes['campaign_logo'],
];
}
}
}

$data = array_merge(
$data,
[
'fields' => $attributes,
'redirect_url' => isset( $attributes['thankyou_url'] ) ? filter_var( $attributes['thankyou_url'], FILTER_VALIDATE_URL ) : '',
'nonce_action' => 'enform_submit',
'form' => $rendered_form,
'campaign_data' => $campaign_data,
]
);

Expand Down
2 changes: 1 addition & 1 deletion react-blocks/build/editorIndex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-blocks/build/editorIndex.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-blocks/build/editorStyle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion react-blocks/build/editorStyle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion react-blocks/build/editorStyle.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3b8eed4

Please sign in to comment.