This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span class="copyright">© {{ 'now'|date('Y') }} Dejan • All rights reserved</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hook_preprocess_html(&$variables) { | |
// Add node title as body class. | |
if ($node = \Drupal::routeMatch()->getParameter('node')) { | |
$node = $node->getTranslation('en'); | |
$title = $node->label(); | |
$title = str_replace(' ', '-', $title); | |
$title = str_replace('_', '-', $title); | |
$variables['title_en'] = strtolower($title); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_theme_theme_suggestions_page_alter(array &$suggestions, array $variables) { | |
// Naming templates based on page title. | |
if ($node = \Drupal::routeMatch()->getParameter('node')) { | |
$translation = $node->getTranslation('en'); | |
$suggestions[] = 'page__node__' . strtolower($translation->title->value); | |
$title = $node->getTitle(); | |
foreach ($suggestions as &$replace) { | |
$replace = str_replace(' ', '_', $replace); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_theme_preprocess_node(&$variables) { | |
if (($variables['elements']['#attributes']['data-history-node-id']) == 10) { | |
$variables['attributes']['class'][] = 'about-us-'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_theme_preprocess_page(&$variables) { | |
if ($variables['is_front']) { | |
$variables['#attached']['library'][] = 'my_theme/googleMap'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ link(content.field_products_image, content.field_products_read_more[0]['#url'], { 'class':['class-link']} ) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function THEME_theme_suggestions_form_alter(array &$suggestions, array $variables) { | |
$suggestions[] = 'form__' . $variables['element']['#form_id']; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Async await func | |
async function getTimelineData() { | |
var response = await fetch('/some-api-url') | |
return response.json() | |
} | |
async function populateTimelineInit() { | |
var data = await getTimelineData(); | |
new vis.DataSet(data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MomentJS library. | |
// Filter array and get only items that are from today (date). | |
var getTodayEvents = someArray.filter(todayDate => moment(todayDate.start.format("YYYY-MM-DD")).isSame(moment().format("YYYY-MM-DD"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import './App.css'; | |
import { AuthProvider } from './Hoc/AuthProvider/AuthProvider'; | |
import Login from './Containers/Login/Login'; | |
import ProtectedRoute from './Components/ProtectedRoute/ProtectedRoute'; | |
class App extends Component { | |
render() { | |
return ( |
OlderNewer