TC
Twill CMSHazarcan Doğa

Repeaters and Blockeditor won't work with media library.

I saw the pst regarding JSON repeaters. So I switched to the block editor for the content that NEEDS some kind of a repeater. How can I achieve this? What should I upgrade or how can I integrate this repeatable medias feature? In our design, there are lots of blocks that needs this.
ifox
ifox101d ago
I'm not sure what you mean @Hazarcan Doğa, you can create blocks that include repeater fields, in which you can use medias fields Repeaters and blocks perfectly work with the media library. only JSON repeaters don't Repeaters outside of blocks also work with the media library, as long as you are storing the repeated item in a dedicated model, with a hasMany relationship, instead of storing everything in a JSON column (which in most cases is not a great idea)
Hazarcan Doğa
Hazarcan Doğa101d ago
I am not sure that I fully grasp the difference between the JSON repeaters and normal repeaters.
ifox
ifox101d ago
from a form standpoint they are the same, the difference is where you save it with json repeaters, you save it in a column of your model with a normal repeater you saive it in a separate model
Hazarcan Doğa
Hazarcan Doğa101d ago
For example I think "InlineRepeater" is the json repeater. In which case it doesn't work because fields are saved as a JSON instead of a blockable releationship
No description
ifox
ifox101d ago
with a foreign key like I said, form is the same for both oh you're in a block??? repeaters in blocks are just children blocks
Hazarcan Doğa
Hazarcan Doğa101d ago
However, this is a block I created, if I use it it will work with media. However when I call it inside a "BlockEditor" form field, again the media relations won't work am IO correct
No description
Hazarcan Doğa
Hazarcan Doğa101d ago
Yes
Hazarcan Doğa
Hazarcan Doğa101d ago
I am trying to integrate this block with a repeater of media, browser and multiple text fields.
No description
Hazarcan Doğa
Hazarcan Doğa101d ago
And there are many more structures where I need media inside a repeater, all related to blocks of course. So it is crucial for me to find a work around about this. I need to use medias with repeaters inside blocks. I read the documentation maybe I missed something.
ifox
ifox101d ago
there is no work around needed to do this. what exactly is not working? did you set a crop configuration for your medias field named bg?
Hazarcan Doğa
Hazarcan Doğa100d ago
What do you mean by repeaters here? the first example in this page? https://twillcms.com/docs/form-fields/repeater.html
Twill
Hazarcan Doğa
Hazarcan Doğa100d ago
Of course the issue is, when I use the block like this in BlockEditor FormField
No description
Hazarcan Doğa
Hazarcan Doğa100d ago
These are my crops
No description
ifox
ifox100d ago
You need a ratio in those crops If you don't want to force any ratio, use 0 or null
Hazarcan Doğa
Hazarcan Doğa100d ago
@ifox I was mistaken, When I used BlockEditor form field and separated the repeater conten into an another block, medias worked fine. However, eventhough I added to ratios to the crops as you suggested, In the editor page, media fields are fetched empty eventhough I know I filled the fields before saving and refreshing the page. The video shows what I mean.
ifox
ifox100d ago
What's the name of your nested blocks medias field? ha variable_image I guess and it renders on your frontend, I see, so it actually saves correctly I'll try to reproduce
Hazarcan Doğa
Hazarcan Doğa100d ago
Yes, it does. The first component is a nested block, second one is normal as you can see, both have the same problem.
ifox
ifox100d ago
Can you please share the 2 block classes? also, which version of Twill are you on?
Hazarcan Doğa
Hazarcan Doğa100d ago
I was in my lunch break yes sure
Hazarcan Doğa
Hazarcan Doğa100d ago
This is the first block
No description
Hazarcan Doğa
Hazarcan Doğa100d ago
Second block (developed in twill 2.0)
No description
Hazarcan Doğa
Hazarcan Doğa100d ago
"version": "3.x-dev",
Hazarcan Doğa
Hazarcan Doğa100d ago
additionally page module class
No description
ifox
ifox100d ago
In the form for Page, what do you have?
Hazarcan Doğa
Hazarcan Doğa100d ago
This is what I have
No description
Hazarcan Doğa
Hazarcan Doğa100d ago
@ifox do you think that using a blade in the module and formBuilder in blocks would couse this?
ifox
ifox100d ago
it should not That shouldn't normally be an issue but try naming variable_image inside one of the 2 blocks differently (and a new crop key in config accordingly)
Hazarcan Doğa
Hazarcan Doğa100d ago
I changed one and removed the other block from the page, still the same issue.
Hazarcan Doğa
Hazarcan Doğa100d ago
This is the output of "$this->form($id)" in edit() method of A17\Twill\Http\Controllers\Admin\ModuleController
No description
ifox
ifox100d ago
I think I got it You're using translated medias fields? And/or changed the main locale of your application?
Hazarcan Doğa
Hazarcan Doğa100d ago
Data seems to be like that but normally no I don't use medias to be translated Let me check
ifox
ifox100d ago
I see tr in the medias keys
Hazarcan Doğa
Hazarcan Doğa100d ago
yes you are correct the system language is in turkish However I don't use translated() option in media fields let me check one thing
ifox
ifox100d ago
Check twill.media_library config It's enabled globally
Hazarcan Doğa
Hazarcan Doğa100d ago
Yes that was the cause... Thank you very much. One more question, what if I'd use a repeater with a blade template on it's own... would media worked the same way it worked in BlockEditor?
ifox
ifox100d ago
yes
Want results from more Discord servers?
Add your server
More Posts
Tag Field on Block not Displaying Saved TagsHello. I am using the Tag Field in a block, the tags are being saved correctly, but the field is cFile link in view issueHi everyone i'm trying to render a file in blade view bug seem difficult to me how can i render linIssue using repository methods??? Twill 3Can someone please provide any support for the following error: Declaration of App\Repositories\PostHow can I make sure my assets are loaded correctly on a subdomain?I have a site for example website.nl and a twill installation on website.nl/subsite Now when I go tI can't see any images in twill media library.Hello, everyone! I have installed twill and tried to upload a image to media library. However, I amDatePicker ExceptionI'm getting an unexpected error while using a pretty simple DatePicker in my sidebar form. `UndefinSome fresh vibes would be nice :))Would love to hear some global announcement about twill cms this year and where it's heading @ifox .Edit defaultOrders in controllerWhat would be the most correct way to edit? $this->defaultOrders of ModuleController in my controlleVue2 EOL Plans?We're upgrading our application and generally upgrading our setup in preparation for the Vue2 EOL atRoute [admin.password.reset.link] not defined on upgrade from 2.x to 3Hey folks, I followed the upgrade guide step by step successfully, but when I try to visit the adminTwicpics & fit=cropApparently fit=crop is automatically added to the url, also when using Twicpics as image service. HoCan anyone help me get a single image/media field working within a json repeater ?I've detailed the issue here: https://github.com/area17/twill/discussions/2358DatePicker problemHi! sorry, what s wrong with my setup .... Just installed a fresh laravel app, with newest twill 3Admin api requests blocked for mixed-contentThis is an odd one and happening in a single environment (which unfortunately is production) . I knoI'm lookig for the DNS Settings of my website. Can anybody help me please?The person who made my website is not available and i need to access my dns settings. Thanks!How to load images in smaller size while keeping aspect ratio and not cutting parts of it off?Hello, I am trying display images with a smaller width that I uploaded in my CMS but without any cr419 login superadminHi all, I'm deploying a project with docker containers, I created a superadmin, I try to log in and Call to a member function permissions() on stringCan you give me a hint, please? In config/twill.php I specified return [ 'enabled' => [ 'perpermalinkGood morning, everyone. I wanted to ask a question. I would like to have the possibility to add a buConditionally render block fields?Is there a way to render block fields based on a field value outside of the block? I want to conditi