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

    elkex

    03/08/2023, 3:26 PM
    Is it possible to add a browser field to a settings section?
  • i

    ifox

    03/08/2023, 3:30 PM
    Only in Twill 3
  • i

    ifox

    03/08/2023, 3:31 PM
    in twill 2 I'd recommend a singleton module instead of a settings page
  • e

    elkex

    03/08/2023, 3:43 PM
    Ok
  • e

    elkex

    03/08/2023, 3:43 PM
    Yes, I was thinking about Singleton too
  • e

    elkex

    03/08/2023, 3:48 PM
    Would you recommend the https://github.com/cwsdigital/twill-metadata for SEO fields?
  • e

    elkex

    03/08/2023, 3:49 PM
    I don't know if it is owned by Twill or not.
  • i

    ifox

    03/08/2023, 3:58 PM
    It isn't but it's great and still maintained, they already added twill 3 support
  • e

    elkex

    03/08/2023, 4:09 PM
    Nice ok!
  • k

    Koili

    03/09/2023, 9:13 AM
    Hello! Is it possible to write validation rules for a specific crop of a
    medias
    form field? my usecase would be validating that a block-editor block with a medias form field, has at least X amount of images attached in a single
    medias
    form field Something along the lines of this:
    Copy code
    php
    @twillBlockValidationRules([
        'medias.cover' => [
            'required',
            'min:12'
        ],
    ])
    EDIT: Nevermind I figured out how to target the medias.cover properly. Ended up using this:
    Copy code
    php
    @twillBlockValidationRules([
        'cover' => [
            'required',
            'array',
            'between:12,16'
        ],
    ])
    where the medias form field name is
    cover
  • d

    david HUN

    03/09/2023, 9:40 AM
    Hi all. I'm new with Twill. I would like to get low quality placeholder for my images. Is there any way to generate LQIP after I upload an image into media library? Now I need run artisan command manually. Twill 2.12.4
  • d

    david HUN

    03/09/2023, 9:42 AM
    I store my images locally
  • j

    jefsev

    03/09/2023, 10:51 AM
    Hi, would i be able to include my own component view in say getSideFieldsets in my controller to show on the edit page sidebar? I would like to get some data from my model and output like a summary.
  • i

    ifox

    03/09/2023, 10:51 AM
    Hi @david HUN you can either decide to it in
    afterSave
    on a module repository, or globally using the EventServiceProvider. The
    cms-module.save
    event is triggered any time you make a change. So you can listen to that event and trigger the command.
  • i

    ifox

    03/09/2023, 10:52 AM
    Hi @jefsev you can use
    BladePartial
    for that
  • j

    jefsev

    03/09/2023, 10:56 AM
    thx great 🙂
  • d

    david HUN

    03/09/2023, 10:57 AM
    Thank you, that is an awesome idea!
  • j

    jefsev

    03/09/2023, 11:03 AM
    How would i share variable to the view useing BladePartial? It doesnt work like normal view()
  • i

    ifox

    03/09/2023, 11:17 AM
    @jefsev
    BladePartial::make()->view('view')->withAdditionalParams([...])
  • i

    ifox

    03/09/2023, 11:18 AM
    I think we should amend that to take data in the view method to avoid the confusion with a normal view method
  • j

    jefsev

    03/09/2023, 12:04 PM
    thx again
  • j

    jefsev

    03/09/2023, 12:04 PM
    🙂
  • e

    elkex

    03/09/2023, 1:29 PM
    I cannot achieve to get the nestedSlug for a nestedpage.. It only returns the top parent.. I implemented the hasNested trait, installed the package etc, so that all should work.. I also added the following in my admin controller:
    Copy code
    protected $showOnlyParentItemsInBrowsers = true;
    
        protected $nestedItemsDepth = 3;
    
        protected function form($id, $item = null)
        {
            $item = $this->repository->getById($id, $this->formWith, $this->formWithCount);
    
            $this->permalinkBase = $item->ancestorsSlug;
    
            return parent::form($id, $item);
        }
    And I also added the following to the frontend controller:
    Copy code
    $page = app(PageRepository::class)->forNestedSlug($slug);
    However it still only returns my top slug..
  • i

    ifox

    03/09/2023, 1:30 PM
    how did you setup the route to your frontend page controller?
  • e

    elkex

    03/09/2023, 1:31 PM
    Route::name('page')->get('/{slug}', [PageController::class, 'index'])->where('slug', '.*');
    i
    • 2
    • 5
  • i

    ifox

    03/09/2023, 1:34 PM
    when you dd $slug in your page controller, do you see a nested slug?
  • m

    Marcin

    03/09/2023, 1:34 PM
    Hi. I have problem with creating new Block (twill 3.0.0-rc4)... im following docs, created "article" block and I cant do it readable by Vue component in CMS. I allso try to append others from vendor\area17\twill\src\Commands\stubs\blocks\* but I see on frontend only two natives: image, text. I also try to move "article" block to views\twill directory and it didnt help. Any idea?
    i
    • 2
    • 6
  • e

    elkex

    03/09/2023, 1:38 PM
    I think I know what the problem is.. I added a general navigation to my provider with a browser which loads the pages, this all works perfectly, but if I loop through the items, I don't think my item is connected to my repository so I miss this part:
    Copy code
    $page = app(PageRepository::class)->forNestedSlug($slug);
    And therefor it does not know it is a child..
  • f

    feelgoodinc

    03/09/2023, 1:58 PM
    Hi, for a client's website I need to display a datatable () but there's no specific formfield to do this. It's also not available in the wysiwig according to the docs. What do you recommend? All datatables contain a lot of numbers and most of them have different headers.
  • k

    kalle

    03/09/2023, 2:11 PM
    Hello, definitely I feel ur need, since I stumble upon this always. Twill offers currently fields to manage data, but none to only display something like tables. I resolved this by creating custom vue components, but its something Twill really needs.
1...472473474...484Latest