Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMS-1028: Add social-media link column to footer #29

Merged
merged 2 commits into from
May 19, 2024
Merged
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
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 Milavida
* Description: Tampere Multisite Milavida Theme
* Version: 1.2.4
* Version: 1.2.5
* Author: Geniem
* Author URI: https://geniem.fi
* Template: tms-theme-base
Expand Down
Loading