https://twill.io logo
Join Discord
Powered by
# ❓questions
  • i

    ifox

    07/06/2022, 5:44 PM
    did you create any block? the idea is that you can create as many as you want, text and and image are just basic examples
  • i

    ifox

    07/06/2022, 5:47 PM
    depending on what a video embed mean to your application as far as content model: it may just be a single input field for a url, or that + a caption field + an image field for the video poster, whatever you need
  • j

    JeanSilva

    07/06/2022, 5:55 PM
    hmm, its because I've saw these in the docs inside twill:
    Copy code
    'blocks' => ['title', 'quote', 'text', 'image', 'grid', 'test', 'publications', 'news']
    then, I think I'll better rephrase my question hehe: these are the only types of blocks? One example would be to create a block content inside the form to let the user add as many blocks they need, usually it would be paragraphs and images so they can write something and reorder as they need. Then, if they want to add a new block of "video", they could insert the video's url inside a block, then it would print the video in the position the user ordered the blocks. The application I'm working on uses laravel only for admins to publish content then it sends the data as json to another application that has the views, templates, etc.
  • i

    ifox

    07/06/2022, 5:58 PM
    I think you misunderstood the field. these are example block names, they don't even exist in Twill. you can create a
    video
    block in your application that will become available in the list of blocks you want to allow in a
    block_editor
    field. eg, filename: views/admin/blocks/video.blade.php
    Copy code
    @twillBlockTitle('Video')
    
    @formField('input', [
        'name' => 'video_url',
        'label' => 'Video URL',
    ])
  • i

    ifox

    07/06/2022, 5:59 PM
    > One example would be to create a block content inside the form to let the user add as many blocks they need, usually it would be paragraphs and images so they can write something and reorder as they need. Then, if they want to add a new block of "video", they could insert the video's url inside a block, then it would print the video in the position the user ordered the blocks. that's exactly how the field works, but you need to come up with your own set of blocks
  • i

    ifox

    07/06/2022, 6:00 PM
    A more complex example would look like this: filename: views/admin/blocks/media.blade.php
    Copy code
    php
    @twillBlockTitle('Media')
    @twillBlockIcon('image')
    
    @formField('medias', [
        'name' => 'image',
        'label' => 'Images',
        'withVideoUrl' => false,
        'max' => 20,
    ])
    
    @formField('files', [
        'name'  => 'video',
        'label' => 'Video',
        'note'  => 'Video will overwrite previously selected images',
        'max'   => 1
    ])
    
    @formField('input', [
        'name' => 'caption',
        'label' => 'Caption',
        'maxlength' => 250,
        'translated' => true,
    ])
    
    @formField('select', [
        'name' => 'effect',
        'label' => 'Transition Effect',
        'placeholder' => 'Select Transition Effect',
        'default' => 'cut',
        'options' => [
            [
                'value' => 'cut',
                'label' => 'Cut'
            ],
            [
                'value' => 'fade',
                'label' => 'Fade In/Out'
            ]
        ]
    ])
    
    @formField('color', [
        'name'  => 'bg',
        'label' => 'Background color',
        'note'  => 'Default is light grey (#E6E6E6)',
    ])
    
    @formField('input', [
        'name' => 'timing',
        'label' => 'Timing',
        'maxlength' => 250,
        'note' => 'Timing in ms (default is 4000ms)',
    ])
  • i

    ifox

    07/06/2022, 6:01 PM
    https://twill.io/docs/block-editor/
  • j

    JeanSilva

    07/06/2022, 6:03 PM
    thanks, now I understand it better
  • i

    ifox

    07/06/2022, 6:07 PM
    I see where the confusion is coming from though, we need to improve the form field doc to better explain it
  • j

    JeanSilva

    07/06/2022, 7:43 PM
    its also because I'm working on a project already in live here at the company and I've never used twill, so there are somethings already done here that I need to check, thats why maybe I post some odd questions haha 😅
  • j

    JeanSilva

    07/06/2022, 7:44 PM
    thanks for the answers and your attention @ifox
  • i

    ifox

    07/06/2022, 7:59 PM
    no worries!
  • d

    dakaalim

    07/06/2022, 10:03 PM
    How can I list out all the browser values on the table?
  • i

    ifox

    07/06/2022, 10:12 PM
    with an accessor on your model
  • u

    24kappa

    07/07/2022, 7:06 AM
    Hello @ifox, did you have the time to test it?
  • s

    Sami

    07/07/2022, 7:46 AM
    Don't know if bug but if
    @twillRepeaterTitleField('heading', ['hidePrefix' => 'true'])
    is below
    @twillRepeaterTrigger('Add')
    , the first line gets printed to the form, example: beginning of `repeater.blade.php`:
    Copy code
    php
    @twillRepeaterTitle('Financing step')
    @twillRepeaterTrigger('Add step')
    @twillRepeaterTitleField('heading', ['hidePrefix' => true])
    Results in:
  • s

    Sami

    07/07/2022, 7:47 AM
    It does not happen when
    ['hidePrefix' => true]
    isn't there in the last line (or if the last 2 lines are swapped)
  • s

    Sami

    07/07/2022, 8:53 AM
    Just figured out my case didn't work because the field is a number, not a string. I made an accessor to convert the field
    number
    (which is an integer in the database) to string and it seems to work just fine 😓
  • s

    Shiftless

    07/07/2022, 9:10 AM
    hello i have a question about the form fields in twill. is there a way to update them after save without reloading or even when a browser changes an other field changes regarding off the selection?
  • i

    ifox

    07/07/2022, 9:16 AM
    @Shiftless the browser field can be used with the connected field, but it sounds like in your case you also need to show new data that are the result of the save. In that case you can use
    reloadOnSuccess
    in your form to force it to reload after a save
  • i

    ifox

    07/07/2022, 9:20 AM
    Interesting, can you create a GitHub issue for this? thanks
  • s

    Shiftless

    07/07/2022, 9:31 AM
    thank you i will give it a try. we had to tell Conten managers to reload by hand.
  • s

    Shiftless

    07/07/2022, 9:38 AM
    so i does the job. even though i was hoping for a solution with out the reload via vue. but we can live with this.
  • i

    ifox

    07/07/2022, 9:39 AM
    you can always use a custom vue component / some javascript to do it if you want to avoid reloading
  • i

    ifox

    07/07/2022, 9:39 AM
    can you share more about the use case?
  • d

    dedli

    07/07/2022, 12:54 PM
    Hi ) Is it possible to see absolute link to file https://monosnap.com/file/NBRNWaBTgPoVVhUHiNZcHulBzEKNSk ? Maybe it is possible to show this link anywhere in medialibary?
  • i

    ifox

    07/07/2022, 1:23 PM
    it's not possible to show it without overriding Vue components but the download button is a link to it
  • d

    dedli

    07/07/2022, 1:42 PM
    Thanks ) Am I understand right that overriding is a bad solution and I will have problems in future with updates?
  • i

    ifox

    07/07/2022, 1:54 PM
    It's not necessarily bad per se but yes it definitely can be a problem when updating. Because you can override specific components you should be fine though, make sure to keep track of changes on the files you override when you update Twill.
  • i

    ifox

    07/07/2022, 1:55 PM
    or submit a PR with the change 😎
1...358359360...484Latest