Skip to content

Commit

Permalink
TMS-1028: Add social-media link column to footer (#45)
Browse files Browse the repository at this point in the history
* TMS-1028: Add social-media link column to footer

* 1.2.5
  • Loading branch information
eebbi authored May 19, 2024
1 parent 01053ae commit 180a35e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
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.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
Expand Down
22 changes: 22 additions & 0 deletions models/shared/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
*
Expand Down
24 changes: 24 additions & 0 deletions partials/shared/footer-inner.dust
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,30 @@
{#link_columns}
{>"shared/footer-column" /}
{/link_columns}

{?some_link_columns}
<div class="column {column_class|attr}">
{?some_link_columns.column_title}
<h2 class="h4 mt-4 mb-4">
{some_link_columns.column_title|html}
</h2>
{/some_link_columns.column_title}

<ul class="is-unstyled {Footer.typography.column|attr}">
{#some_link_columns.some_link_column}
<li class="mb-3">
<a href="{some_link.url|url}" target="{some_link.target|attr}"
class="is-flex is-align-items-center {Footer.colors.link|attr}">
{>"ui/icon" icon="{some_icon|attr}" class="icon--xlarge is-primary-invert mr-2" /}
<span>
{some_link.title|html}
</span>
</a>
</li>
{/some_link_columns.some_link_column}
</ul>
</div>
{/some_link_columns}
</div>

<div class="columns is-multiline is-vcentered mt-4 mt-0-desktop">
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 180a35e

Please sign in to comment.