onsen-1.0.x-dev/onsen.module
onsen.module
<?php
/**
* Implements hook_theme().
*/
function onsen_theme($existing, $type, $theme, $path) {
return [
'demo' => [
'variables' => ['var' => NULL],
],
'ons_switch' => [
'template' => 'ons-switch',
'variables' => [
'checked' => NULL,
'channel' => NULL,
'data' => NULL, //data attributes
'disabled' => NULL,
'id' => NULL, //real device id. not to be public exposed
'input-id' => NULL, // mask id
'label' => NULL,
'modifier' => NULL,
],
],
];
}
/**
* Implements hook_page_attachments_alter().
*/
function onsen_page_attachments(&$variables) {
$variables['#attached']['library'][] = 'onsen/onsen';
$variables['#attached']['library'][] = 'onsen/custom';
if (\Drupal::routeMatch()->getRouteName() === "onsen.demo") {
$variables['#attached']['library'][] = 'onsen/demo';
}
}
