Skip to content

Commit

Permalink
Merge pull request #176 from devgeniem/TMS-1028
Browse files Browse the repository at this point in the history
TMS-1028: Add social media link-list block, component & footer section
  • Loading branch information
eebbi authored May 19, 2024
2 parents ed8038a + c05ce9f commit 0585b9a
Show file tree
Hide file tree
Showing 21 changed files with 483 additions and 36 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [1.8.13] - 2024-05-20

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

## [1.8.12] - 2024-05-14

- TMS-1029: Change contacts-blocks width
Expand Down
6 changes: 6 additions & 0 deletions assets/icons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,9 @@ import './place.svg';
import './date-range.svg';
import './save.svg';
import './user.svg';
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.
84 changes: 71 additions & 13 deletions lib/ACF/Fields/Settings/FooterSettingsTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ class FooterSettingsTab extends Tab {
'title' => 'Linkki',
'instructions' => '',
],
'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',
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 0585b9a

Please sign in to comment.