Freepaper Info and Flipbook
This is a custom module which works with the Above All template for the twelvetribes.org website. The module displays two different modals (popups): Info and Flipbook. Info displays the body text of the Publication, along with its image and title. The Flipbook displays a browsable 3D view of the PDF.
<div class="pub__container">
<div class="pub__cover">
<img src="{{field_image}}" class="pub__image">
</div>
<h5>{{title}}</h5>
<h6>{{created}}</h6>
<div class="pub__middle">
<div class="pub__text">
<a class="btn btn-default" href="#" role="button" data-action="freepaper-info" data-id="pub_i{{nid}}" data-title=" {{ title }}" data-body="{{ body }}" ><i class="fa fa-1x fa-info-circle"></i> Info</a>
<a class="btn" href="#" role="button" data-action="freepaper-flipbook" data-id="pub_f{{nid}}" data-title=" {{ title_1 }}" data-pdf="{{ field_pdf }}"><i class="fa fa-1x fa-book-open"></i> View</a>
<a class="btn" href="{{ field_pdf }}" target="_blank"><i class="fa fa-1x fa-download"></i> Download</a>
</div>
</div>
<div class="receiver"></div>
</div>
The classes and structure are important. They work together with the other files to load new text into the receiver element.
- Mevaser
'); } } function freepaper_preprocess_page(&$variables){ // Drupal 8-9 // global $base_url; // $host = $base_url; // $variables['#attached']['drupalSettings']['modulepath'] = drupal_get_path('module', 'freepaper'); // $variables['#attached']['drupalSettings']['host'] = $host; // // $variables['#attached']['library'][] = 'freepaper/flipbook'; We will attach it in the twig template // DRUPAL 10 $host = Url::fromRoute('