Skip to content

Commit

Permalink
Fix undefined act_page warning (#2471)
Browse files Browse the repository at this point in the history
This was reported by Sentry
  • Loading branch information
mleray authored Dec 11, 2024
1 parent fbc9ff0 commit 021e9ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
23 changes: 12 additions & 11 deletions src/MasterBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,24 +172,25 @@ public function enqueue_block_public_assets(): void
*/
private function get_p4_options(): array
{
$option_values = get_option('planet4_options');
$is_new_ia = !empty(planet4_get_option('new_ia'));
$take_action_page = planet4_get_option('take_action_page', '');
$act_page = planet4_get_option('act_page', '');

$cookies_default_copy = [
'necessary_cookies_name' => $option_values['necessary_cookies_name'] ?? '',
'necessary_cookies_description' => $option_values['necessary_cookies_description'] ?? '',
'analytical_cookies_name' => $option_values['analytical_cookies_name'] ?? '',
'analytical_cookies_description' => $option_values['analytical_cookies_description'] ?? '',
'all_cookies_name' => $option_values['all_cookies_name'] ?? '',
'all_cookies_description' => $option_values['all_cookies_description'] ?? '',
'necessary_cookies_name' => planet4_get_option('necessary_cookies_name', ''),
'necessary_cookies_description' => planet4_get_option('necessary_cookies_description', ''),
'analytical_cookies_name' => planet4_get_option('analytical_cookies_name', ''),
'analytical_cookies_description' => planet4_get_option('analytical_cookies_description', ''),
'all_cookies_name' => planet4_get_option('all_cookies_name', ''),
'all_cookies_description' => planet4_get_option('all_cookies_description', ''),
];

return [
'enable_analytical_cookies' => $option_values['enable_analytical_cookies'] ?? '',
'enable_google_consent_mode' => $option_values['enable_google_consent_mode'] ?? '',
'enable_analytical_cookies' => planet4_get_option('enable_analytical_cookies', ''),
'enable_google_consent_mode' => planet4_get_option('enable_google_consent_mode', ''),
'cookies_default_copy' => $cookies_default_copy,
'take_action_covers_button_text' => $option_values['take_action_covers_button_text'] ?? '',
'take_action_page' => $is_new_ia ? $option_values['take_action_page'] : $option_values['act_page'],
'take_action_covers_button_text' => planet4_get_option('take_action_covers_button_text', ''),
'take_action_page' => $is_new_ia ? $take_action_page : $act_page,
'new_ia' => $is_new_ia,
];
}
Expand Down
13 changes: 6 additions & 7 deletions src/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ public function is_campaign_page(): bool
*/
public function is_get_informed_page(): bool
{
$act_page_id = planet4_get_option('get_informed_page');
$get_informed_page_id = planet4_get_option('get_informed_page');

return absint($act_page_id) === $this->id;
return absint($get_informed_page_id) === $this->id;
}

/**
Expand All @@ -117,9 +117,9 @@ public function is_get_informed_page(): bool
*/
public function is_take_action_page(): bool
{
$act_page_id = planet4_get_option('take_action_page');
$take_action_page_id = planet4_get_option('take_action_page');

return absint($act_page_id) === $this->id;
return absint($take_action_page_id) === $this->id;
}

/**
Expand All @@ -128,9 +128,9 @@ public function is_take_action_page(): bool
*/
public function is_about_us_page(): bool
{
$act_page_id = planet4_get_option('about_us_page');
$about_us_page_id = planet4_get_option('about_us_page');

return absint($act_page_id) === $this->id;
return absint($about_us_page_id) === $this->id;
}

/**
Expand Down Expand Up @@ -163,7 +163,6 @@ public function get_new_ia_child_page_DLV(): string
public function set_issues_links(): void
{
// Retrieve P4 settings in order to check that we add only categories that are children of the Issues category.
$options = get_option('planet4_options');
$categories = get_the_category($this->ID);

$this->issues_nav_data = array_map(
Expand Down

0 comments on commit 021e9ef

Please sign in to comment.