Browse Source

Filter by subjects.

pull/27/head
Ned Zimmerman 7 years ago
parent
commit
81a402fda9
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 2
      app/controllers/App.php
  2. 4
      resources/views/partials/book.blade.php

2
app/controllers/App.php

@ -141,7 +141,7 @@ class App extends Controller
$book['date-published'] = (isset($book['metadata']['datePublished'])) ?
$book['metadata']['datePublished'] :
'';
$book['subject'] = (isset($book['metadata']['keywords'])) ? $book['metadata']['keywords'] : '';
$book['subject'] = (isset($book['metadata']['about'][0])) ? $book['metadata']['about'][0]['identifier'] : '';
$books[] = $book;
}
if ($orderby === 'latest') {

4
resources/views/partials/book.blade.php

@ -1,11 +1,11 @@
<div class="book"
data-date-published="{{ str_replace('-', '', @$book['metadata']['datePublished']) }}"
data-license="{{ (new \Pressbooks\Licensing())->getLicenseFromUrl($book['metadata']['license']['url']) }}"
data-subject="{{ sanitize_title(@$book['metadata']['keywords']) }}"
data-subject="{{ substr(@$book['subject'], 0, 2) }}"
>
@if(isset($book['metadata']['keywords']))
<p class="book__subject">
<a href="{{ network_home_url('/catalog/#') . $book['metadata']['keywords'] }}">{{ $book['metadata']['keywords'] }}</a>
<a href="{{ network_home_url('/catalog/#') . substr($book['subject'], 0, 2) }}">{{ \Pressbooks\Metadata\get_subject_from_thema($book['subject']) }}</a>
</p>
@endif
<p class="book__title">

Loading…
Cancel
Save