composer is almost finished, ramins to record compos order through ajax

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-26 21:21:00 +02:00
parent 0fedff7573
commit 90c9c68dcd
26 changed files with 1048 additions and 89 deletions
@@ -28,7 +28,7 @@ function template_preprocess_edlp_chutier_ui(&$vars){
// get the title
$title = $node->getTitle();
if(!$title) continue;
$trunc_title = Unicode::truncate($title, 30, true, true);
$trunc_title = Unicode::truncate($title, 25, true, true);
// classes
$classes = array('audio-link', 'ajax-link');
// get the entries
@@ -2,9 +2,10 @@
function template_preprocess_edlp_composition_ui(&$vars){
// dpm($vars);
/*
@see https://www.drupal8.ovh/index.php/en/tutoriels/339/render-a-node-or-an-entity
*/
// $view_builder = \Drupal::entityTypeManager()->getViewBuilder($vars['entity_type']);
// $vars['content'] = $view_builder->view($vars['entity'], $vars['view_mode']);
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('composition');
$vars['composition'] = $view_builder->view($vars['lastcomposition']);
}
@@ -9,6 +9,7 @@ function template_preprocess_edlp_compositions_list(&$vars){
'#theme' => 'item_list',
'#items' => [],
);
$i = 0;
foreach($vars['composition_entities'] as $entity){
// get the url
$url = Url::fromRoute('entity.composition.canonical',
@@ -27,8 +28,8 @@ function template_preprocess_edlp_compositions_list(&$vars){
'#options'=>array(
'attributes' => array(
'data-drupal-link-system-path' => $url->getInternalPath(),
'nid' => $entity->id(),
'class' => ['composition-link'],
'cid' => $entity->id(),
'class' => ['composition-link', $i==0 ? 'is-active':''],
'title'=>$title,
),
),
@@ -40,13 +41,14 @@ function template_preprocess_edlp_compositions_list(&$vars){
'#options'=>array(
'attributes' => array(
'data-drupal-link-system-path' => $delete_url->getInternalPath(),
'nid' => $entity->id(),
'cid' => $entity->id(),
'class' => ['delete-composition-link'],
'title'=> t('Delete @title', array('@title'=>$title)),
),
),
)
);
$i++;
}
$vars['compositions']['#items'][] = array(