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

    Sami

    07/06/2022, 2:07 PM
    You can get the uuid of the file by
    $this->fileObject(<file role>)->uuid)
    and prefix this with path to the files folder
  • d

    dedli

    07/06/2022, 2:21 PM
    Perfect! Thank you very much!
  • d

    dedli

    07/06/2022, 2:22 PM
    And in resourse details view is it possible to add readonly field with same link?
  • s

    Sami

    07/06/2022, 2:25 PM
    I think so - if you mean the form view. It's still a blade file so you can use html/css and send the link to view using
    getFormFields()
    - just add the link to the array and in view you should be able to access it
  • s

    Sami

    07/06/2022, 2:25 PM
    or maybe
    getIndexData()
    would work too but I haven't used it before EDIT: better from @ifox: https://discord.com/channels/811936425858695198/811986149064441927/994256541479870554
  • d

    dedli

    07/06/2022, 2:31 PM
    thanks a lot I will try )
  • u

    24kappa

    07/06/2022, 2:40 PM
    Hi, im having some problems adding custom icons for the block editor, i tried follow the instructions here https://twill.io/docs/block-editor/creating-a-block-editor.html#using-custom-icons on my
    Copy code
    config/twill.php
    in
    Copy code
    block_editor
    i've added
    Copy code
    'directories' => [
                'source' => [
                    'icons' => [
                        base_path('assets/admin/icons'),
                        resource_path('assets/admin/icons'),
                    ],
                ],
            ],
    i can see the icons if i go to https://admin.site.dev/admin/icons but i can't see anymore the block editor button . Maybe I'm doing something wrong with the configurations
  • i

    ifox

    07/06/2022, 2:59 PM
    you'd need to keep Twill's directory in the array @24kappa
  • i

    ifox

    07/06/2022, 3:00 PM
    you also have access to
    $item
    in the form view to render anything you'd like from the model @dedli
  • i

    ifox

    07/06/2022, 3:00 PM
    for indexColumns, it won't work well with self nested modules
  • u

    24kappa

    07/06/2022, 3:02 PM
    so config should be like this?
    Copy code
    'directories' => [
                'source' => [
                    'icons' => [
                        base_path('vendor/area17/twill/frontend/icons'),
                        resource_path('assets/admin/icons'),
                    ],
                ],
            ],
  • i

    ifox

    07/06/2022, 3:02 PM
    yes
  • s

    Sami

    07/06/2022, 3:05 PM
    I tried this and doesn't work - even if I keep there only the twill path
  • u

    24kappa

    07/06/2022, 3:05 PM
    Did it, but still cannot see the block editor button on form page
  • u

    24kappa

    07/06/2022, 3:05 PM
    yes, unfortunately
  • i

    ifox

    07/06/2022, 3:08 PM
    You're probably missing the blocks source directories now that you're using this config, but you shouldn't actually need to override it as Twill by default already tries to load your custom icons https://github.com/area17/twill/blob/f9cd9eee5d07543230d65dd0a5f90ec556363db7/config/blocks.php#L85
  • i

    ifox

    07/06/2022, 3:08 PM
    in
    views/admin/icons
  • s

    Sami

    07/06/2022, 3:13 PM
    I tried that just out of curiosity and I can't get it to work. Block editor shows up (as it did before for me) but the icon is missing
  • d

    dedli

    07/06/2022, 3:14 PM
    Is it possible to load file in create modal? When I set @formField('files') in create.blade.php it ignores this field and does not show it. And one more, when I try to edit resource in modal (set protected $indexOptions = [ 'editInModal' => true]) I lose title and my fiels form fields.
  • u

    24kappa

    07/06/2022, 3:15 PM
    i tried this:
    Copy code
    'directories' => [
    
                'source' => [
                    'blocks' => [
                        [
                            'path' => base_path('vendor/area17/twill/src/Commands/stubs/blocks'),
                            'source' => A17\Twill\Services\Blocks\Block::SOURCE_TWILL,
                        ],
                        [
                            'path' => resource_path('views/admin/blocks'),
                            'source' => A17\Twill\Services\Blocks\Block::SOURCE_APP,
                        ],
                    ],
        
                    'repeaters' => [
                        [
                            'path' => resource_path('views/admin/repeaters'),
                            'source' => A17\Twill\Services\Blocks\Block::SOURCE_APP,
                        ],
                        [
                            'path' => base_path('vendor/area17/twill/src/Commands/stubs/repeaters'),
                            'source' => A17\Twill\Services\Blocks\Block::SOURCE_TWILL,
                        ],
                    ],
        
                    'icons' => [
                        base_path('vendor/area17/twill/frontend/icons'),
                        resource_path('assets/admin/icons'),
                    ],
                ],
    this worked, so i have to override all the config keys?
  • i

    ifox

    07/06/2022, 3:23 PM
    seems like it for this key specifically. Usually we merge with defaults but I guess not for this.
  • i

    ifox

    07/06/2022, 3:23 PM
    files field is not compatible with the create modal
  • i

    ifox

    07/06/2022, 3:24 PM
    if you want to use editInModal you need to manage fields in create.blade.php not form.blade.php
  • u

    24kappa

    07/06/2022, 3:24 PM
    sorry but i was trying with an icon that is already present on twill, so it seems is not rendering the icons i've added on my resource_path('assets/admin/icons'),
  • u

    24kappa

    07/06/2022, 3:26 PM
    i can see all the icons listed even with
    Copy code
    php artisan twill:list:icons
    but the new icons are not available on blocks.
  • i

    ifox

    07/06/2022, 3:28 PM
    alright, I'll try this out later today, not sure what's wrong
    u
    h
    • 3
    • 41
  • u

    24kappa

    07/06/2022, 3:29 PM
    Thanks
  • s

    Sami

    07/06/2022, 5:03 PM
    Just want to bring up that I haven't solved this yet 😦
  • d

    dedli

    07/06/2022, 5:38 PM
    Thanks, I know it. I set title and files to create.blade.php and when it is create everything fine, but when it is edit in modal title and file fields does not show https://monosnap.com/file/UvyFzTaDZ8lAFxdMJPEoDERQvoC909
    Copy code
    admin/documents/create.blade.php
    @include('twill::partials.create')
    @formField('input', ['name' => 'parent_id','label' => 'Id батьківського ресурсу'])
    @formField('date_picker', [    'name' => 'published_at',    'label' => 'Дата публікації',    'withTime' => false    ])
    @formField('files', [    'name' => 'file',    'label' => 'Документ',])
  • j

    JeanSilva

    07/06/2022, 5:42 PM
    hi, another question: is there a way to add a new options for the formfield block_editor do add video embeds? It has images, but can it have videos?
1...357358359...484Latest