Closed degrovejazz closed 3 years ago
Hey this sounds very familiar. I was able to solve the issue by adding the crops array to twill.php config file.
The issue is the block model does not contain any defaults for $mediasParams, so for the blocks you need to add your crop configuration into the twill config. The easiest way I found to debug this one was to check the conditions in HandleMedias.php function getMedias line 78-79. Hope this helps 👍
@adam-code-labx thanks for the message. Yeah, I have added the proper config to twill.config. Media blocks save to the db fine in the blocks and mediables tables, but they are not returned for editing.
I had already looked through the HandlesMedia class and debugged it for POST and PUT the blocks, but that function is not used for retrieving the modal. In other words, the related media is not being retrieved to fill "medias" forms within blocks.
OK then before I dive deeper into this with you, can you 1st share the output of your media array.
If you dump $medias in HandleBlocks.php line 218 dd($medias);
do you see your gallery array?
If the data is there then the issue would most likely be with resources/views/admin/blocks/gallery.blade.php
if your able to share this file. Also check your mediable_id matches with the block id in the the Db and share these result so I can take a further look into this.
Thanks a lot for the help. Your instructions to grab the media array from HandleBocks.php showed me the problem. I had extended the Block.php model which was causing the issue. Now that I removed the call to the extension, its working fine. Thanks again.
Hello,
Loving Twill, but running in to a problem I've spent hours trying to resolve.
I have "gallery" as a block option. Everything persist to the DB fine - the block row is created and the mediables are created with a row for each crop. So, I can pull everything I need for the frontend of my site.
The problem, the block editor does not add the actual medial to the block for the user to edit. Thus, when they return to edit the block, there is now media there (images or files).
I've looked through a lot of Twill code and it seems, when the blocks that related to the module are retreived, there is no way for the related mediables to be grabbed to. Thus, the vue for the block does not setup properly with the actual media.
Hope this makes sense.