Skip to content
Snippets Groups Projects
Commit 89413d1b authored by dqd's avatar dqd
Browse files

Issue #3251810 by dqd: Continuous naming conventions

parent 7d15d49c
No related branches found
No related tags found
1 merge request!5Update 8 files
Pipeline #299411 passed with warnings
File moved
......@@ -2,19 +2,19 @@
/**
* @file
* Library requirements for AOS.
* Library requirements for Animate On Scroll.
*/
/**
* Implements hook_install().
*/
function aos_install() {
function animate_on_scroll_install() {
// Check for AOS Library.
$library = \Drupal::service('library.discovery')->getLibraryByName('aos', 'aos_lib');
$library = \Drupal::service('library.discovery')->getLibraryByName('animate_on_scroll', 'animate_on_scroll_lib');
$library_exists = file_exists(DRUPAL_ROOT . '/' . $library['css'][0]['data']);
if (!$library_exists) {
$download_url = 'https://github.com/michalsnik/aos/archive/master.zip';
$message = t('Animate On Scroll module requires the AOS library. <a href=":aos_lib_link">Download AOS library</a> and unzip into /libraries/aos.', [':aos_lib_link' => $download_url]);
$message = t('Animate On Scroll module requires the AOS library. <a href=":animate_on_scroll_lib_link">Download AOS library</a> and unzip into /libraries/aos.', [':animate_on_scroll_lib_link' => $download_url]);
$messenger = \Drupal::messenger();
$messenger->addMessage($message, 'warning');
}
......@@ -23,10 +23,10 @@ function aos_install() {
/**
* Implements hook_requirements().
*/
function aos_requirements($phase) {
// Verify AOS is enabled.
function animate_on_scroll_requirements($phase) {
// Verify Animate On Scroll is enabled.
if ($phase == 'runtime') {
$library = \Drupal::service('library.discovery')->getLibraryByName('aos', 'aos_lib');
$library = \Drupal::service('library.discovery')->getLibraryByName('animate_on_scroll', 'animate_on_scroll_lib');
$library_exists = file_exists(DRUPAL_ROOT . '/' . $library['css'][0]['data']);
return [
'aos_library_downloaded' => [
......
aos_lib:
animate_on_scroll_lib:
js:
/libraries/aos/dist/aos.js: {}
js/script.js: {}
......
<?php
/**
* @file
* Integration with AOS library.
*/
/**
* Implements hook_help().
*/
function animate_on_scroll_help($path, $arg) {
switch ($path) {
case 'admin/help#animate_on_scroll':
return '<p>' . t('<a href="@animate_on_scroll" target="_blank">Animate On Scroll</a> is a small library to animate elements on your page as you scroll. It allows you to animate elements as you scroll down, and up. If you scroll back to top, elements will animate to it\'s previous state and are ready to animate again if you scroll down.', [
'@animate_on_scroll' => 'https://michalsnik.github.io/aos/',
]) . '</p>';
}
}
/**
* Implements hook_page_attachments().
*/
function animate_on_scroll_page_attachments(array &$attachments) {
// Attach AOS library to all pages.
$attachments['#attached']['library'][] = 'animate_on_scroll/animate_on_scroll_lib';
}
<?php
/**
* @file
* Integration with AOS library.
*/
/**
* Implements hook_help().
*/
function aos_help($path, $arg) {
switch ($path) {
case 'admin/help#aos':
return '<p>' . t('<a href="@aos" target="_blank">Animate On Scroll</a> is a small library to animate elements on your page as you scroll. It allows you to animate elements as you scroll down, and up. If you scroll back to top, elements will animate to it\'s previous state and are ready to animate again if you scroll down.', [
'@aos' => 'https://michalsnik.github.io/aos/',
]) . '</p>';
}
}
/**
* Implements hook_page_attachments().
*/
function aos_page_attachments(array &$attachments) {
// Attach AOS library to all pages.
$attachments['#attached']['library'][] = 'aos/aos_lib';
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment