Skip to content

Commit

Permalink
TMS-1028: Add social media link-list block, component & footer section
Browse files Browse the repository at this point in the history
  • Loading branch information
eebbi committed Apr 23, 2024
1 parent 6d7016f commit d7060d4
Show file tree
Hide file tree
Showing 20 changed files with 502 additions and 50 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- TMS-1028: Add social media link-list block, component & footer section

## [1.54.9] - 2024-04-18

- TMS-1031: Fix event-component recurring manual-event dates
Expand Down
6 changes: 6 additions & 0 deletions assets/icons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,9 @@ import './veistospuisto.svg';
import './vkontakte.svg';
import './whatsapp.svg';
import './accessibility';
import './instagram.svg';
import './youtube.svg';
import './tiktok.svg';
import './snapchat.svg';
import './spotify.svg';
import './threads.svg';
3 changes: 3 additions & 0 deletions assets/icons/instagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/snapchat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/spotify.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/threads.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/tiktok.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions assets/icons/twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/youtube.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 85 additions & 27 deletions lib/ACF/Fields/Settings/FooterSettingsTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,59 +30,68 @@ class FooterSettingsTab extends Tab {
* @var array
*/
protected $strings = [
'tab' => 'Alatunniste',
'footer_logo' => [
'tab' => 'Alatunniste',
'footer_logo' => [
'title' => 'Logo',
'instructions' => '',
],
'contact_title' => [
'contact_title' => [
'title' => 'Yhteystietojen otsikko',
'instructions' => '',
],
'address' => [
'address' => [
'title' => 'Osoite',
'instructions' => '',
],
'email' => [
'email' => [
'title' => 'Sähköposti',
'instructions' => '',
],
'phone' => [
'phone' => [
'title' => 'Puhelinnumero',
'instructions' => '',
],
'link_columns' => [
'link_columns' => [
'title' => 'Linkkipalstat',
'instructions' => '',
'button_label' => 'Lisää linkkipalsta',
],
'column_title' => [
'column_title' => [
'title' => 'Otsikko',
'instructions' => '',
],
'link_column' => [
'link_column' => [
'title' => 'Linkkipalsta',
'instructions' => '',
'button_label' => 'Lisää linkki',
],
'link' => [
'link' => [
'title' => 'Linkki',
'instructions' => '',
],
'privacy_links' => [
'some_link_column' => [
'title' => 'Some-linkkipalsta',
'instructions' => '',
'button_label' => 'Lisää linkki',
],
'some_icon' => [
'title' => 'Some-ikoni',
'instructions' => '',
],
'privacy_links' => [
'title' => 'Tietosuojalinkit',
'instructions' => 'Saavutettavuusselosteet ja tietosuojalinkit',
'button_label' => 'Lisää linkki',
],
'privacy_link' => [
'privacy_link' => [
'title' => 'Linkki',
'instructions' => '',
],
'hero_credits' => [
'hero_credits' => [
'title' => 'Etusivun hero-kuvan tekijätieto tai kuvaajan nimi',
'instructions' => '',
],
'copyright' => [
'copyright' => [
'title' => 'Copyright-teksti',
'instructions' => '© ja vuosi lisätään automaattisesti syötettyä tekstiä ennen',
],
Expand Down Expand Up @@ -113,87 +122,135 @@ public function sub_fields( $key ) {

try {
$logo_field = ( new Field\Image( $strings['footer_logo']['title'] ) )
->set_key( "${key}_footer_logo" )
->set_key( "{$key}_footer_logo" )
->set_name( 'footer_logo' )
->set_return_format( 'id' )
->set_wrapper_width( 50 )
->set_instructions( $strings['footer_logo']['instructions'] );

$contact_title_field = ( new Field\Text( $strings['contact_title']['title'] ) )
->set_key( "${key}_contact_title" )
->set_key( "{$key}_contact_title" )
->set_name( 'contact_title' )
->set_wrapper_width( 50 )
->set_instructions( $strings['contact_title']['instructions'] );

$address_field = ( new Field\Textarea( $strings['address']['title'] ) )
->set_key( "${key}_address" )
->set_key( "{$key}_address" )
->set_name( 'address' )
->set_new_lines( 'wpautop' )
->set_wrapper_width( 50 )
->set_instructions( $strings['address']['instructions'] );

$email_field = ( new Field\Email( $strings['email']['title'] ) )
->set_key( "${key}_email" )
->set_key( "{$key}_email" )
->set_name( 'email' )
->set_wrapper_width( 50 )
->set_instructions( $strings['email']['instructions'] );

$phone_field = ( new Field\Text( $strings['phone']['title'] ) )
->set_key( "${key}_phone" )
->set_key( "{$key}_phone" )
->set_name( 'phone' )
->set_wrapper_width( 50 )
->set_instructions( $strings['phone']['instructions'] );

$link_columns_field = ( new Field\Repeater( $strings['link_columns']['title'] ) )
->set_key( "${key}_link_columns" )
->set_key( "{$key}_link_columns" )
->set_name( 'link_columns' )
->set_layout( 'block' )
->set_max( 3 )
->set_button_label( $strings['link_columns']['button_label'] )
->set_instructions( $strings['link_columns']['instructions'] );

$column_title_field = ( new Field\Text( $strings['column_title']['title'] ) )
->set_key( "${key}_column_title" )
->set_key( "{$key}_column_title" )
->set_name( 'column_title' )
->set_instructions( $strings['column_title']['instructions'] );

$link_columns_field->add_field( $column_title_field );

$link_column_field = ( new Field\Repeater( $strings['link_column']['title'] ) )
->set_key( "${key}_link_column" )
->set_key( "{$key}_link_column" )
->set_name( 'link_column' )
->set_button_label( $strings['link_column']['button_label'] )
->set_instructions( $strings['link_column']['instructions'] );

$link_columns_field->add_field( $link_column_field );

$link_field = ( new Field\Link( $strings['link']['title'] ) )
->set_key( "${key}_link" )
->set_key( "{$key}_link" )
->set_name( 'link' )
->set_instructions( $strings['link']['instructions'] );

$link_column_field->add_field( $link_field );

$some_link_columns_field = ( new Field\Group( $strings['some_link_column']['title'] ) )
->set_key( "{$key}_some_link_columns" )
->set_name( 'some_link_columns' )
->set_instructions( $strings['some_link_column']['instructions'] );

$some_link_column_field = ( new Field\Repeater( $strings['some_link_column']['title'] ) )
->set_key( "{$key}_some_link_column" )
->set_name( 'some_link_column' )
->set_layout( 'block' )
->set_button_label( $strings['some_link_column']['button_label'] )
->set_instructions( $strings['some_link_column']['instructions'] );

$some_icon = ( new Field\Select( $strings['some_icon']['title'] ) )
->set_key( "{$key}_some_icon" )
->set_name( 'some_icon' )
->set_choices( [
'facebook' => 'Facebook',
'instagram' => 'Instagram',
'twitter' => 'X (Twitter)',
'youtube' => 'YouTube',
'linkedin' => 'LinkedIn',
'tiktok' => 'TikTok',
'snapchat' => 'Snapchat',
'spotify' => 'Spotify',
'threads' => 'Threads',
] )
->set_default_value( 'facebook' )
->set_required()
->set_wrapper_width( 50 )
->set_instructions( $strings['some_icon']['instructions'] );

$some_link = ( new Field\Link( $strings['link']['title'] ) )
->set_key( "{$key}_some_link" )
->set_name( 'some_link' )
->set_required()
->set_wrapper_width( 50 )
->set_instructions( $strings['link']['instructions'] );

$some_link_column_field->add_fields( [
$some_icon,
$some_link,
] );

$some_link_columns_field->add_fields( [
$column_title_field,
$some_link_column_field,
] );

$privacy_links_field = ( new Field\Repeater( $strings['privacy_links']['title'] ) )
->set_key( "${key}_privacy_links" )
->set_key( "{$key}_privacy_links" )
->set_name( 'privacy_links' )
->set_button_label( $strings['privacy_links']['button_label'] )
->set_instructions( $strings['privacy_links']['instructions'] );

$privacy_link_field = ( new Field\Link( $strings['privacy_link']['title'] ) )
->set_key( "${key}_privacy_link" )
->set_key( "{$key}_privacy_link" )
->set_name( 'privacy_link' )
->set_instructions( $strings['privacy_link']['instructions'] );

$privacy_links_field->add_field( $privacy_link_field );

$hero_credits_field = ( new Field\Text( $strings['hero_credits']['title'] ) )
->set_key( "${key}_hero_credits" )
->set_key( "{$key}_hero_credits" )
->set_name( 'hero_credits' )
->set_instructions( $strings['hero_credits']['instructions'] );

$copyright_field = ( new Field\Text( $strings['copyright']['title'] ) )
->set_key( "${key}_copyright" )
->set_key( "{$key}_copyright" )
->set_name( 'copyright' )
->set_instructions( $strings['copyright']['instructions'] );

Expand All @@ -204,6 +261,7 @@ public function sub_fields( $key ) {
$email_field,
$phone_field,
$link_columns_field,
$some_link_columns_field,
$privacy_links_field,
$hero_credits_field,
$copyright_field,
Expand Down
Loading

0 comments on commit d7060d4

Please sign in to comment.