Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Feature/header update #132

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
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
60 changes: 36 additions & 24 deletions block-languages/benenson-blocks.pot
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ msgstr ""

#: src/scripts/blocks/action/BlockEdit.js:62
#: src/scripts/blocks/blockquote/index.js:246
#: src/scripts/blocks/header/DisplayComponent.js:134
#: src/scripts/blocks/header/DisplayComponent.js:138
#: src/scripts/blocks/tweet/index.js:91
msgid "Size"
msgstr ""
Expand Down Expand Up @@ -88,15 +88,15 @@ msgstr ""

#: src/scripts/blocks/appearance-options/index.js:39
#: src/scripts/blocks/blockquote/index.js:232
#: src/scripts/blocks/header/DisplayComponent.js:95
#: src/scripts/blocks/header/DisplayComponent.js:96
#: src/scripts/blocks/menu/DisplayComponent.js:12
#: src/scripts/blocks/section/DisplayComponent.js:49
msgid "White"
msgstr ""

#: src/scripts/blocks/appearance-options/index.js:42
#: src/scripts/blocks/blockquote/index.js:226
#: src/scripts/blocks/header/DisplayComponent.js:98
#: src/scripts/blocks/header/DisplayComponent.js:99
msgid "Black"
msgstr ""

Expand Down Expand Up @@ -125,7 +125,7 @@ msgstr ""
#: src/scripts/blocks/call-to-action/DisplayComponent.js:46
#: src/scripts/blocks/category-list/DisplayComponent.js:62
#: src/scripts/blocks/columns/DisplayComponent.js:28
#: src/scripts/blocks/header/DisplayComponent.js:120
#: src/scripts/blocks/header/DisplayComponent.js:124
#: src/scripts/blocks/iframe/DisplayComponent.js:89
#: src/scripts/blocks/link/DisplayComponent.js:53
#: src/scripts/blocks/menu/DisplayComponent.js:96
Expand Down Expand Up @@ -173,7 +173,7 @@ msgstr ""

# text alignment. for RTL languages, localise as 'Right'
#: src/scripts/blocks/blockquote/index.js:164
#: src/scripts/blocks/header/DisplayComponent.js:76
#: src/scripts/blocks/header/DisplayComponent.js:77
#: src/scripts/blocks/image/BlockEdit.js:201
#: src/scripts/blocks/link/DisplayComponent.js:41
#: src/scripts/blocks/slider/DisplayComponent.js:37
Expand All @@ -189,15 +189,15 @@ msgstr ""

# text alignment. for RTL languages, localise as 'Left'
#: src/scripts/blocks/blockquote/index.js:170
#: src/scripts/blocks/header/DisplayComponent.js:83
#: src/scripts/blocks/header/DisplayComponent.js:84
#: src/scripts/blocks/image/BlockEdit.js:208
#: src/scripts/blocks/link/DisplayComponent.js:47
#: src/scripts/blocks/slider/DisplayComponent.js:44
msgid "Right"
msgstr ""

#: src/scripts/blocks/blockquote/index.js:214
#: src/scripts/blocks/header/DisplayComponent.js:114
#: src/scripts/blocks/header/DisplayComponent.js:118
#: src/scripts/blocks/links-with-icons/InnerBlockEdit.js:223
#: src/scripts/blocks/logo-list/InnerBlockEdit.js:139
#: src/scripts/blocks/section/DisplayComponent.js:60
Expand Down Expand Up @@ -236,7 +236,7 @@ msgid "Add a blockquote block"
msgstr ""

#: src/scripts/blocks/blockquote/index.js:240
#: src/scripts/blocks/header/DisplayComponent.js:122
#: src/scripts/blocks/header/DisplayComponent.js:126
#: src/scripts/blocks/image/BlockEdit.js:220
msgid "Alignment"
msgstr ""
Expand Down Expand Up @@ -431,22 +431,26 @@ msgstr ""
msgid "Edit File"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:103
#: src/scripts/blocks/header/DisplayComponent.js:104
#: src/scripts/blocks/image/BlockEdit.js:389
msgid "Image"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:106
#: src/scripts/blocks/header/DisplayComponent.js:107
#: src/scripts/blocks/image/BlockEdit.js:392
msgid "Video"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:111
#: src/scripts/blocks/header/DisplayComponent.js:112
#: src/scripts/blocks/section/DisplayComponent.js:68
msgid "Normal"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:128
#: src/scripts/blocks/header/DisplayComponent.js:115
msgid "Full height"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:132
#: src/scripts/blocks/key-facts/index.js:68
#: src/scripts/blocks/links-with-icons/BlockEdit.js:81
#: src/scripts/blocks/logo-list/BlockEdit.js:67
Expand All @@ -455,58 +459,66 @@ msgstr ""
msgid "Background Colour"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:140
#: src/scripts/blocks/header/DisplayComponent.js:144
#: src/scripts/blocks/image/BlockEdit.js:387
msgid "Background Type"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:146
#: src/scripts/blocks/header/DisplayComponent.js:150
#: src/scripts/blocks/media-aside/DisplayComponent.js:52
msgid "Embed url"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:150
#: src/scripts/blocks/header/DisplayComponent.js:154
msgid ""
"Setting this will override the cta link and will now open a modal with the "
"embed in the hero."
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:152
#: src/scripts/blocks/header/DisplayComponent.js:156
msgid "Bleed into navigation/header"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:161
#: src/scripts/blocks/section/DisplayComponent.js:105
msgid "Background Image"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:152
#: src/scripts/blocks/header/DisplayComponent.js:161
msgid "Featured Image"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:155
#: src/scripts/blocks/header/DisplayComponent.js:164
msgid "Featured Video"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:177
#: src/scripts/blocks/header/DisplayComponent.js:186
msgid "(Header Title)"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:186
#: src/scripts/blocks/header/DisplayComponent.js:195
msgid "(Header Content)"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:197
#: src/scripts/blocks/header/DisplayComponent.js:220
msgid "(Call to action)"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:79
#: src/scripts/blocks/header/DisplayComponent.js:237
msgid "(Bullets)"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:80
#: src/scripts/blocks/image/BlockEdit.js:205
#: src/scripts/blocks/slider/DisplayComponent.js:40
msgid "Centre"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:89
#: src/scripts/blocks/header/DisplayComponent.js:90
msgid "Translucent black"
msgstr ""

#: src/scripts/blocks/header/DisplayComponent.js:92
#: src/scripts/blocks/header/DisplayComponent.js:93
#: src/scripts/blocks/key-facts/index.js:50
#: src/scripts/blocks/link/DisplayComponent.js:30
#: src/scripts/blocks/links-with-icons/BlockEdit.js:57
Expand Down
56 changes: 40 additions & 16 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@

$hero_identifier = substr( md5( uniqid( wp_rand(), true ) ), 0, 8 );

$header_style = benenson_get_meta_field( '_nav_style', $page_id );
$hero_title = benenson_get_meta_field( '_hero_title' );
$hero_content = benenson_get_meta_field( '_hero_content' );
$hero_cta_text = benenson_get_meta_field( '_hero_cta_text' );
$hero_cta_link = benenson_get_meta_field( '_hero_cta_link' );
$hero_alignment = benenson_get_meta_field( '_hero_alignment' ) ?: 'left';
$hero_background = benenson_get_meta_field( '_hero_background', $page_id );
$hero_size = benenson_get_meta_field( '_hero_size', $page_id );
$hero_type = benenson_get_meta_field( '_hero_type', $page_id );
$hero_video_id = benenson_get_meta_field( '_hero_video_id', $page_id );
$hero_embed = benenson_get_meta_field( '_hero_embed', $page_id );
$header_style = benenson_get_meta_field( '_nav_style', $page_id );
$hero_title = benenson_get_meta_field( '_hero_title' );
$hero_content = benenson_get_meta_field( '_hero_content' );
$hero_cta_text = benenson_get_meta_field( '_hero_cta_text' );
$hero_cta_link = benenson_get_meta_field( '_hero_cta_link' );
$hero_cta_two_text = benenson_get_meta_field( '_hero_cta_two_text' );
$hero_cta_two_link = benenson_get_meta_field( '_hero_cta_two_link' );
$hero_bullets = benenson_get_meta_field( '_hero_bullets' );
$hero_bleed = benenson_get_meta_field( '_hero_bleed' ) ? 'page-heroStyle--behindNav' : '';
$hero_alignment = benenson_get_meta_field( '_hero_alignment' ) ?: 'left';
$hero_background = benenson_get_meta_field( '_hero_background', $page_id );
$hero_size = benenson_get_meta_field( '_hero_size', $page_id );
$hero_type = benenson_get_meta_field( '_hero_type', $page_id );
$hero_video_id = benenson_get_meta_field( '_hero_video_id', $page_id );
$hero_embed = benenson_get_meta_field( '_hero_embed', $page_id );

$hero_show = false;
$media_lg = false;
Expand Down Expand Up @@ -130,7 +134,7 @@
}
</style>
<?php endif; ?>
<section id="hero-<?php echo esc_html( $hero_identifier ); ?>" class="page-hero <?php 'video' === $hero_type && print 'page-hero--video'; ?> page-heroSize--<?php echo esc_attr( $hero_size ); ?> page-heroBackground--<?php echo esc_attr( $hero_background ); ?> page-heroAlignment--<?php echo esc_attr( $hero_alignment ); ?>" role="region" <?php ( $hero_title || is_archive() ) && print 'aria-labelledby="herotitle"'; ?>>
<section id="hero-<?php echo esc_html( $hero_identifier ); ?>" class="page-hero <?php 'video' === $hero_type && print 'page-hero--video'; ?> page-heroSize--<?php echo esc_attr( $hero_size ); ?> page-heroBackground--<?php echo esc_attr( $hero_background ); ?> page-heroAlignment--<?php echo esc_attr( $hero_alignment ); ?> <?php echo esc_attr( $hero_bleed ); ?>" role="region" <?php ( $hero_title || is_archive() ) && print 'aria-labelledby="herotitle"'; ?>>
<?php
if ( 'video' === $hero_type && $hero_video_id ) :
$source = wp_get_attachment_url( $hero_video_id );
Expand All @@ -152,11 +156,21 @@
<?php if ( is_archive() && $object->description ) : ?>
<p class="page-heroContent"><?php echo wp_kses_post( $object->description ); ?></p>
<?php endif; ?>
<?php if ( $hero_cta_text && ( $hero_cta_link || $hero_embed ) ) : ?>
<?php if ( $hero_cta_text && ( $hero_cta_link || $hero_embed ) || ( $hero_cta_two_text && $hero_cta_two_link ) ) : ?>
<div class="page-heroCta">
<a <?php ( $hero_cta_link && ! $hero_embed ) && printf( 'href="%s"', esc_url( $hero_cta_link ) ); ?> class="btn" <?php $hero_embed && printf( 'data-modal-embed="%s"', esc_attr( $hero_embed ) ); // Using esc_attr as the embed could be an ID. ?>><?php $hero_embed && printf( '<i class="play-icon">%s</i>', esc_html__( 'Play Icon', 'benenson' ) ); ?><?php echo esc_html( wp_strip_all_tags( $hero_cta_text ) ); ?></a>
<?php if ( $hero_cta_text && ( $hero_cta_link || $hero_embed ) ) : ?>
<a <?php ( $hero_cta_link && ! $hero_embed ) && printf( 'href="%s"', esc_url( $hero_cta_link ) ); ?> class="btn" <?php $hero_embed && printf( 'data-modal-embed="%s"', esc_attr( $hero_embed ) ); // Using esc_attr as the embed could be an ID. ?>><?php $hero_embed && printf( '<i class="play-icon">%s</i>', esc_html__( 'Play Icon', 'benenson' ) ); ?><?php echo esc_html( wp_strip_all_tags( $hero_cta_text ) ); ?></a>
<?php endif; ?>
<?php if ( $hero_cta_two_text && $hero_cta_two_link ) : ?>
<a <?php printf( 'href="%s"', esc_url( $hero_cta_two_link ) ); ?> class="btn"><?php echo esc_html( wp_strip_all_tags( $hero_cta_two_text ) ); ?></a>
<?php endif; ?>
</div>
<?php endif; ?>
<?php
if ( $hero_bullets ) :
printf( '<div class="page-heroBullets"><div><ul>%s</ul></div></div>', wp_kses_post( $hero_bullets ) );
endif;
?>
</div>
</div>

Expand All @@ -177,11 +191,21 @@
<?php if ( is_archive() && $object->description ) : ?>
<p class="page-heroContent"><?php echo wp_kses_post( $object->description ); ?></p>
<?php endif; ?>
<?php if ( $hero_cta_text && ( $hero_cta_link || $hero_embed ) ) : ?>
<?php if ( $hero_cta_text && ( $hero_cta_link || $hero_embed ) || ( $hero_cta_two_text && $hero_cta_two_link ) ) : ?>
<div class="page-heroCta">
<a <?php ( $hero_cta_link && ! $hero_embed ) && printf( 'href="%s"', esc_url( $hero_cta_link ) ); ?> class="btn" <?php $hero_embed && printf( 'data-modal-embed="%s"', esc_attr( $hero_embed ) ); // Using esc_attr as the embed could be an ID. ?>><?php $hero_embed && printf( '<i class="play-icon">%s</i>', esc_html__( 'Play Icon', 'benenson' ) ); ?><?php echo esc_html( wp_strip_all_tags( $hero_cta_text ) ); ?></a>
<?php if ( $hero_cta_text && ( $hero_cta_link || $hero_embed ) ) : ?>
<a <?php ( $hero_cta_link && ! $hero_embed ) && printf( 'href="%s"', esc_url( $hero_cta_link ) ); ?> class="btn" <?php $hero_embed && printf( 'data-modal-embed="%s"', esc_attr( $hero_embed ) ); // Using esc_attr as the embed could be an ID. ?>><?php $hero_embed && printf( '<i class="play-icon">%s</i>', esc_html__( 'Play Icon', 'benenson' ) ); ?><?php echo esc_html( wp_strip_all_tags( $hero_cta_text ) ); ?></a>
<?php endif; ?>
<?php if ( $hero_cta_two_text && $hero_cta_two_link ) : ?>
<a <?php printf( 'href="%s"', esc_url( $hero_cta_two_link ) ); ?> class="btn"><?php echo esc_html( wp_strip_all_tags( $hero_cta_two_text ) ); ?></a>
<?php endif; ?>
</div>
<?php endif; ?>
<?php
if ( $hero_bullets ) :
printf( '<div class="page-heroBullets"><div><ul>%s</ul></div></div>', wp_kses_post( $hero_bullets ) );
endif;
?>
</div>
</div>
</section>
Expand Down
Loading