Skip to content
Open
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
48 changes: 48 additions & 0 deletions src/wp-content/themes/tuleva/helpers/acf/fund-pension.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,52 @@
'show_in_rest' => 1,
));

acf_add_local_field_group(array (
'key' => 'group_fund_pension_sustainability',
'title' => 'Sustainability',
'fields' => array (
array (
'key' => 'field_fund_pension_co2_intensity',
'label' => 'CO2 Intensity',
'name' => 'fund_co2_intensity',
// Text, not number: the figure is rendered verbatim and trailing zeros are
// significant ("133.80" must not collapse to "133.8"). Matches TKF100's field.
'type' => 'text',
'instructions' => 'CO2 intensity value (number only, e.g. "83.68"). When set, this replaces the hardcoded figure in the template.',
'required' => 0,
),
),
'location' => array (
array (
array (
'param' => 'page_template',
'operator' => '==',
'value' => 'page_fund-stocks.php',
),
),
array (
array (
'param' => 'page_template',
'operator' => '==',
'value' => 'page_fund-bonds.php',
),
),
array (
array (
'param' => 'page_template',
'operator' => '==',
'value' => 'page_fund-third.php',
),
),
),
'menu_order' => 11,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'active' => 1,
// Same REST requirement as the investment report group above.
'show_in_rest' => 1,
));

endif;
4 changes: 4 additions & 0 deletions src/wp-content/themes/tuleva/helpers/acf/fund-savings.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@
'label_placement' => 'top',
'instruction_placement' => 'label',
'active' => 1,
// Lets fund_co2_intensity be set over the REST API, the same way the pension funds'
// field is. TKF100 has no CO2 figure yet; the template hides the whole block while the
// field is empty, so this stays inert until someone supplies a value.
'show_in_rest' => 1,
));

// Documents fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@
<h2 class="mt-5 mb-4 h4"><?php _e('Sustainability information', TEXT_DOMAIN) ?></h2>
<p class="fund-info__item">
<span class="small text-bold"><?php _e('CO2 intensity', TEXT_DOMAIN) ?></span>
<span><?php echo sprintf(__('%s tons / $1M turnover per year', TEXT_DOMAIN), '133.80') ?></span>
<span><?php
// The ACF field is the source of truth. The literal below is only
// the pre-ACF value, and renders only while the field is empty.
// Update the field on the page, not this line: editing the literal
// on a fund whose field is already set changes nothing visible,
// which is a quiet way to believe a figure was published.
$co2_intensity = get_field('fund_co2_intensity') ?: '133.80';
echo sprintf(__('%s tons / $1M turnover per year', TEXT_DOMAIN), esc_html($co2_intensity));
?></span>
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,15 @@
<h2 class="mt-5 mb-4 h4"><?php _e('Sustainability information', TEXT_DOMAIN) ?></h2>
<p class="fund-info__item">
<span class="small text-bold"><?php _e('CO2 intensity', TEXT_DOMAIN) ?></span>
<span><?php echo sprintf(__('%s tons / $1M turnover per year', TEXT_DOMAIN), 83.68) ?></span>
<span><?php
// The ACF field is the source of truth. The literal below is only
// the pre-ACF value, and renders only while the field is empty.
// Update the field on the page, not this line: editing the literal
// on a fund whose field is already set changes nothing visible,
// which is a quiet way to believe a figure was published.
$co2_intensity = get_field('fund_co2_intensity') ?: '83.68';
echo sprintf(__('%s tons / $1M turnover per year', TEXT_DOMAIN), esc_html($co2_intensity));
?></span>
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,15 @@
<h2 class="mt-5 mb-4 h4"><?php _e('Sustainability information', TEXT_DOMAIN) ?></h2>
<p class="fund-info__item">
<span class="small text-bold"><?php _e('CO2 intensity', TEXT_DOMAIN) ?></span>
<span><?php echo sprintf(__('%s tons / $1M turnover per year', TEXT_DOMAIN), 83.73) ?></span>
<span><?php
// The ACF field is the source of truth. The literal below is only
// the pre-ACF value, and renders only while the field is empty.
// Update the field on the page, not this line: editing the literal
// on a fund whose field is already set changes nothing visible,
// which is a quiet way to believe a figure was published.
$co2_intensity = get_field('fund_co2_intensity') ?: '83.73';
echo sprintf(__('%s tons / $1M turnover per year', TEXT_DOMAIN), esc_html($co2_intensity));
?></span>
</p>
</div>
</div>
Expand Down