From 180a35eb3443c23e4feda47f5b4adfe51065d754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20V=C3=A4nttinen?= <31741222+eebbi@users.noreply.github.com> Date: Mon, 20 May 2024 00:04:55 +0300 Subject: [PATCH] TMS-1028: Add social-media link column to footer (#45) * TMS-1028: Add social-media link column to footer * 1.2.5 --- CHANGELOG.MD | 4 ++++ models/shared/footer.php | 22 ++++++++++++++++++++++ partials/shared/footer-inner.dust | 24 ++++++++++++++++++++++++ style.css | 2 +- 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 41f0e13..777d482 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.2.5] - 2024-05-20 + +- TMS-1028: Add social-media link column to footer + ## [1.2.4] - 2024-05-14 - TMS-1029: Change contacts-blocks width diff --git a/models/shared/footer.php b/models/shared/footer.php index 0830ce9..74d1f62 100644 --- a/models/shared/footer.php +++ b/models/shared/footer.php @@ -42,9 +42,11 @@ public function column_class() : string { $contact_info = $this->contact_info(); $second_contact_info = $this->second_contact_info(); $columns = $this->link_columns(); + $some_column = $this->some_link_columns(); $count = empty( $columns ) ? 0 : count( $columns ); $count = empty( $contact_info ) ? $count : ++ $count; $count = empty( $second_contact_info ) ? $count : ++ $count; + $count = empty( $some_column ) ? $count : ++ $count; return $count <= 3 ? 'is-6 is-4-widescreen' @@ -113,6 +115,26 @@ public function link_columns() { return $columns; } + /** + * Get social media link column + * + * @return mixed|null + */ + public function some_link_columns() { + $columns = Settings::get_setting( 'some_link_columns' ) ?? null; + + if ( empty( $columns['some_link_column'] ) ) { + return null; + } + + // Filter out empty links + $columns['some_link_column'] = array_filter( $columns['some_link_column'], function ( $item ) { + return ! empty( $item['some_link']['title'] ); + } ); + + return $columns; + } + /** * Get privacy links * diff --git a/partials/shared/footer-inner.dust b/partials/shared/footer-inner.dust index b27dce1..45717dc 100644 --- a/partials/shared/footer-inner.dust +++ b/partials/shared/footer-inner.dust @@ -77,6 +77,30 @@ {#link_columns} {>"shared/footer-column" /} {/link_columns} + + {?some_link_columns} +
+ {?some_link_columns.column_title} +

+ {some_link_columns.column_title|html} +

+ {/some_link_columns.column_title} + + +
+ {/some_link_columns}
diff --git a/style.css b/style.css index 467ea86..b85a22d 100644 --- a/style.css +++ b/style.css @@ -1,7 +1,7 @@ /* * Theme Name: TMS Theme Amuri * Description: Tampere Multisite Amuri Theme - * Version: 1.2.4 + * Version: 1.2.5 * Author: Geniem * Author URI: https://geniem.fi * Template: tms-theme-base