studio composition : fixed empty field documents bug
This commit is contained in:
@@ -116,7 +116,7 @@
|
||||
$('.composition-link').removeClass('is-active');
|
||||
$link.removeClass('ajax-loading').addClass('is-active');
|
||||
|
||||
$composer.html(data.compo);
|
||||
$('.composition', $composer).replaceWith(data.compo);
|
||||
$composer.removeClass('ajax-loading');
|
||||
initDragAndDropUI();
|
||||
};
|
||||
@@ -260,11 +260,18 @@
|
||||
// |___/|_| \__,_\__, | \_____| |___/|_| \___/ .__/ \___/|___|
|
||||
// |___/ |_|
|
||||
function initDragAndDropUI(){
|
||||
|
||||
// add real dom square element to handle sorting
|
||||
$('.composition_ui .composer .composition .field--name-documents .field__item').each(function(i){
|
||||
// check if field--name-documents exists
|
||||
if (!$('.composition_ui .composer .composition .field--name-documents').length) {
|
||||
// if not create it
|
||||
$field_documents = $('<div>')
|
||||
.addClass('field').addClass('field--name-documents')
|
||||
.appendTo('.composition_ui .composer .composition');
|
||||
}else{
|
||||
// add real dom square element to handle sorting
|
||||
$field_documents = $('.composition_ui .composer .composition .field--name-documents'); $('.field__item', $field_documents).each(function(i){
|
||||
$(this).prepend($('<span>').addClass('handler'));
|
||||
});
|
||||
}
|
||||
|
||||
// create remove dropzone
|
||||
var $remove_zone = $('<div>').addClass('remove-drop-zone')
|
||||
@@ -288,7 +295,7 @@
|
||||
});
|
||||
|
||||
// create sortable
|
||||
$('.composition_ui .composer .composition .field--name-documents').sortable({
|
||||
$field_documents.sortable({
|
||||
revert:false,
|
||||
handle: ".handler",
|
||||
receive:function(e, ui){
|
||||
|
||||
@@ -159,7 +159,7 @@ class CompositionController extends ControllerBase {
|
||||
|
||||
private function getRendredComposition(){
|
||||
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('composition');
|
||||
$compobuild = $view_builder->view($this->compo, 'default');
|
||||
$compobuild = $view_builder->view($this->compo, 'studio_ui');
|
||||
$this->rendered_compo = render($compobuild);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user