This file contains hidden or 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 ($, Drupal) { | |
Drupal.behaviors.globalOpenLuciusBehavior = { | |
attach: function (context, settings) { | |
// Message toaster init. | |
$('.toast').toast('show'); | |
} | |
}; | |
})(jQuery, Drupal); |
This file contains hidden or 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
{# | |
/** | |
* @file | |
* Theme override for status messages. | |
* | |
* Displays status, error, and warning messages, grouped by type. | |
* | |
* An invisible heading identifies the messages for assistive technology. | |
* Sighted users see a colored box. See http://www.w3.org/TR/WCAG-TECHS/H69.html | |
* for info. |
This file contains hidden or 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
<?php | |
/** | |
* Implements hook_preprocess_HOOK() | |
*/ | |
function YOURTHEME_preprocess_paragraph(&$variables) { | |
// Populate color templates vars, based on chosen color. | |
$paragraph = $variables['paragraph']; | |
if(!empty($paragraph->field_bg_color)) { | |
$bg_color = $paragraph->field_bg_color->color; |
This file contains hidden or 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
<?php | |
namespace Drupal\ol_messages\Form; | |
use Drupal\Core\Form\FormBase; | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\Component\Utility\Html; | |
use Drupal\Component\Utility\Xss; | |
use Drupal\file\Entity\File; | |
use Drupal\ol_file\Entity\OlFile; |
This file contains hidden or 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
<?php | |
namespace Drupal\ol_messages\Form; | |
use Drupal\Core\Form\FormBase; | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\Component\Utility\Html; | |
use Drupal\ol_messages\Services\OlMessages; | |
use Symfony\Component\DependencyInjection\ContainerInterface; |
This file contains hidden or 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
<?php | |
/** | |
* Render. | |
* | |
* @param $course_code | |
* | |
* @return array | |
* Returns a renderable array. | |
*/ | |
public function render($course_code) { |
This file contains hidden or 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
<?php | |
/** | |
* Implements hook_library_info_build(). | |
*/ | |
function YOURMODULENAME_library_info_build() { | |
$libraries = []; | |
$module = \Drupal::moduleHandler()->getModule('YOURMODULENAME'); | |
$module_path = $module->getPath(); | |
$path_to_js = \Drupal::service('file_system')->realpath($module_path) . '/js'; | |
$path_to_manifest = $path_to_js . '/build/asset-manifest.json'; |
This file contains hidden or 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
<?php | |
/** | |
* Implements hook_file_download(). | |
* | |
* @param $uri | |
* | |
* @return array | |
*/ | |
function lus_file_download($uri) { |
This file contains hidden or 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
services: | |
<yourmodulename>.event_subscriber: | |
class: Drupal\<yourmodulename>\EventSubscriber\RedirectAnonymousSubscriber | |
arguments: [] | |
tags: | |
- {name: event_subscriber} |
This file contains hidden or 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
<?php | |
namespace Drupal\<yourmodulename>\EventSubscriber; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Symfony\Component\HttpFoundation\RedirectResponse; | |
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | |
use Symfony\Component\HttpKernel\KernelEvents; | |
/** |