#1107: first light_home then async load full home, do not aggregate nor preprocess theme js libraries
This commit is contained in:
@@ -24,6 +24,9 @@ use Drupal\mymodule\Plugin\Field\FieldType\MyFieldComputed;
|
||||
|
||||
// $field_map_kv_store->set('node', $node_map);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Implement hook_entity_bundle_field_info().
|
||||
*
|
||||
@@ -136,6 +139,48 @@ function materio_home_entity_base_field_info_alter(&$fields, EntityTypeInterface
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
*
|
||||
* Register a module or theme's theme implementations.
|
||||
* The implementations declared by this hook specify how a particular render array is to be rendered as HTML.
|
||||
*
|
||||
* See: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21theme.api.php/function/hook_theme/8.2.x
|
||||
*
|
||||
* If you change this method, clear theme registry and routing table 'drush cc theme-registry' and 'drush cc router'.
|
||||
*/
|
||||
function materio_home_theme($existing, $type, $theme, $path) {
|
||||
|
||||
return [
|
||||
// Name of the theme hook. This is used in the controller to trigger the hook.
|
||||
'materio_home' => [
|
||||
'render element' => 'element',
|
||||
// If no template name is defined here, it defaults to the name of the theme hook, ie. module-name-theme-hook.html.twig
|
||||
'template' => 'materio-home',
|
||||
// Optionally define path to Twig template files. Defaults to the module's ./templates/ directory.
|
||||
// 'path' => $path . '/templates',
|
||||
// Optionally define variables that will be passed to the Twig template and set default values for them.
|
||||
// 'variables' => [
|
||||
// 'variable1' => 'Yet another default text.',
|
||||
// 'variable2' => 0,
|
||||
// 'variable3' => [0, 0, 0],
|
||||
// ],
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
function template_preprocess_materio_home(&$vars){
|
||||
$node_view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
||||
$element = $vars['element'];
|
||||
$vm = $element['#view_mode'];
|
||||
$fpnode = $element['#frontpage_node'];
|
||||
$nvb_fpnode = $node_view_builder->view($fpnode, $vm);
|
||||
$vars['frontpage_node'] = $nvb_fpnode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_cron().
|
||||
*
|
||||
|
Reference in New Issue
Block a user