|
@@ -30,10 +30,15 @@ function edlp_studio_help($route_name, RouteMatchInterface $route_match) {
|
|
|
*/
|
|
|
function edlp_studio_page_attachments(array &$attachments) {
|
|
|
$attachments['#attached']['library'][] = 'edlp_studio/edlp_studio-library';
|
|
|
+ // chutier ui
|
|
|
$url = Url::fromRoute('edlp_studio.studio_chutier_ui_ajax', [], ['absolute' => TRUE]);
|
|
|
$attachments['#attached']['drupalSettings']['edlp_studio']['chutier_ui_ajax'] = $url->getInternalPath();
|
|
|
+ // open compo
|
|
|
$url = Url::fromRoute('edlp_studio.composition_controller_action_ajax', ['action'=>'open'], ['absolute' => TRUE]);
|
|
|
$attachments['#attached']['drupalSettings']['edlp_studio']['open_compo_ajax_url'] = $url->getInternalPath();
|
|
|
+ // save compo
|
|
|
+ $url = Url::fromRoute('edlp_studio.composition_controller_action_ajax', ['action'=>'save'], ['absolute' => TRUE]);
|
|
|
+ $attachments['#attached']['drupalSettings']['edlp_studio']['save_compo_ajax_url'] = $url->getInternalPath();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -43,6 +48,10 @@ function edlp_studio_theme($existing, $type, $theme, $path) {
|
|
|
// @see https://www.drupal.org/docs/8/theming/twig/create-custom-twig-templates-from-custom-module
|
|
|
|
|
|
return array(
|
|
|
+ 'composition' => array(
|
|
|
+ 'file' => 'includes/composition.inc',
|
|
|
+ 'render element'=>'elements',
|
|
|
+ ),
|
|
|
'edlp_chutier_ui' => array(
|
|
|
'file' => 'includes/edlp_chutier_ui.inc',
|
|
|
'variables' => array(
|
|
@@ -78,6 +87,29 @@ function edlp_studio_theme($existing, $type, $theme, $path) {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Implements hook_theme_suggestions_HOOK().
|
|
|
+ */
|
|
|
+function edlp_studio_theme_suggestions_composition(array $vars) {
|
|
|
+ // dpm($vars);
|
|
|
+ $suggestions = [];
|
|
|
+
|
|
|
+ /** @var \Drupal\edlp_studio\CompositionInterface $compo */
|
|
|
+ $compo = $vars['elements']['#composition'];
|
|
|
+ //
|
|
|
+ $suggestions[] = 'composition';
|
|
|
+ $suggestions[] = 'composition__' . $compo->id();
|
|
|
+ $suggestions[] = 'composition__' . $vars['elements']['#view_mode'];
|
|
|
+ $suggestions[] = 'composition__' . $compo->id() . '__' . $vars['elements']['#view_mode'];
|
|
|
+ // $suggestions[] = 'taxonomy_term__' . $term->id();
|
|
|
+
|
|
|
+ // dpm($suggestions);
|
|
|
+ return $suggestions;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* hook_entity_extra_field_info()
|
|
|
*
|
|
@@ -151,19 +183,3 @@ function edlp_studio_node_view(array &$build, \Drupal\Core\Entity\EntityInterfac
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-/**
|
|
|
- * Prepares variables for Composition templates.
|
|
|
- *
|
|
|
- * Default template: composition.html.twig.
|
|
|
- *
|
|
|
- * @param array $variables
|
|
|
- * An associative array containing:
|
|
|
- * - elements: An associative array containing the user information and any
|
|
|
- * - attributes: HTML attributes for the containing element.
|
|
|
- */
|
|
|
-// function edlp_studio_preprocess_composition(array &$vars) {
|
|
|
-// dpm($vars);
|
|
|
-// $vars['test'] = 'test';
|
|
|
-// }
|