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 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
// 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 ( |
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 htmlEscape(str) { | |
return str.replace(/>/g,'&') | |
.replace(/</g,'>') | |
.replace(/"/g,'<') | |
.replace(/'/g,'"') | |
.replace(/`/g,''') | |
.replace(/`/g,'`'); | |
} |
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 createStore(reducer) { | |
// Store should have 4 parts. | |
// 1. The state. | |
// 2. Get the state. | |
// 3. Listen to state change. | |
// 4. Update the state. | |
let state; | |
let listeners = []; |
OlderNewer