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

    ifox

    10/25/2022, 2:35 PM
    I think what you were looking for is different than the issue you linked. Since you're working with blade you're free to create partials like you did for reusability of your fields configuration. The issue is more specific about the block editor field so that it can dynamically change options on blocks.
  • s

    savchuk.ivan

    10/25/2022, 2:38 PM
    Yes, you are absolutely right, this is not what I wanted. It is necessary to get into the habit of resting in the evening. The head no longer thinks. But this way I can partially reduce the amount of code if I use blocks that are similar to each other.🤓
  • t

    thingasd

    10/26/2022, 8:20 AM
    Hi guys, does twill have a clone function on a single model?
  • k

    kalle

    10/26/2022, 10:47 AM
    Can you please clarify your usage of this?
  • t

    thingasd

    10/26/2022, 11:25 AM
    Let's say I have a set of blocks that want to share with different pages, now the clone block function is limited to the same page, I know there is prefill template in block editor may help but it is not work as clone does.
  • i

    ifox

    10/26/2022, 11:44 AM
    You're looking for the duplicate feature which you can enable in
    $indexOptions
  • i

    ifox

    10/26/2022, 11:44 AM
    with that, you'll be able to duplicate an entire page with its blocks (from the three dots button in the module listing)
  • d

    dakaalim

    10/26/2022, 10:34 PM
    I have a problem with using block with module.
  • i

    ifox

    10/26/2022, 10:41 PM
    I'm not following. Are you getting multiple airports models and calling renderBlocks in a loop?
  • d

    dakaalim

    10/26/2022, 10:42 PM
    This is my airport module
  • d

    dakaalim

    10/26/2022, 10:43 PM
    The block
  • d

    dakaalim

    10/26/2022, 10:44 PM
    If I visit
    /auckland-airport
    it should return me
    Auckland Airport
    as its header. But when I visit
    /christchurch-airport
    , the header is still showing as
    Auckland Airport
    instead of
    Christchurch Airport
  • d

    dakaalim

    10/26/2022, 10:45 PM
    the code for the block hero-regular.php
    Copy code
    @php
    
    $transformed = _transform($block);
    $data = $transformed['data'] ?? [];
    
    @endphp
    
    <div>$data['header']</div>
    the variable
    $block
    always grabs the very first row in the table
  • i

    ifox

    10/26/2022, 10:47 PM
    ok, that's quite strange. What about your view to render the airport? Are you using renderBlocks on the airport model in there? What is your transform helper doing?
  • d

    dakaalim

    10/26/2022, 10:49 PM
    this is the layout for the airport module
    Copy code
    @extends('layouts.app')
    
    @section('permalink', route('location', ['slug' => $item->getSlug()]) ?? '')
    
    @section('title', $title ?? '')
    
    @section('description', $description ?? '')
    
    @push('styles')
    <style>
    </style>
    @endpush
    
    @section('content')
    @isset($published)
    {!! $item->renderBlocks() !!}
    @endisset
    @endsection
    
    @push('scripts')
    <script>
    </script>
    @endpush
  • i

    ifox

    10/26/2022, 10:50 PM
    dd($item->blocks()->first())
  • i

    ifox

    10/26/2022, 10:50 PM
    Is that returning the correct block?
  • d

    dakaalim

    10/26/2022, 10:53 PM
    I'm on /christchurch-airport, incorrect block id
  • i

    ifox

    10/26/2022, 10:58 PM
    I mean this is a native Laravel relationship, so I really don't get how it would return the wrong relationship, are you sure your item variable is the one location you think it is?
  • d

    dakaalim

    10/26/2022, 11:00 PM
    nvm ifox, it's my mistake
  • d

    dakaalim

    10/26/2022, 11:01 PM
    the problem is in the twill controller and transformer class for that module
  • d

    dakaalim

    10/26/2022, 11:02 PM
    this is a TIL for me 😅
  • i

    ifox

    10/26/2022, 11:03 PM
    Mind sharing what was wrong?
  • d

    dakaalim

    10/26/2022, 11:05 PM
    airport = location btw so the variable
    $item
    came from its transformer
  • d

    dakaalim

    10/26/2022, 11:07 PM
    below is the controller that passes its data over to its transformer
  • d

    dakaalim

    10/26/2022, 11:08 PM
    ->first()
    is the culprit
  • i

    ifox

    10/27/2022, 9:46 AM
    Yeah, I was guessing there was a first involved somewhere haha. why are you throwing another query when your model variable is already returned from a query (published scope is applied for you in forSlug)?
  • h

    Hip-Hop

    10/27/2022, 9:55 AM
    Good afternoon, please help me with my question. I have a page at resources/views/site/about.blade.php (For example) The page structure looks like this Block 1 Some example text Block 2 How can I display blocks when there can be plain text between them?
    i
    h
    • 3
    • 12
  • i

    ifox

    10/27/2022, 10:05 AM
    Content between blocks
  • u

    uwascan

    10/27/2022, 3:17 PM
    Hello @ifox is it possible to add custom commands to each table row of a module along side the default once like delete? I need this custom command to open a modal. Is such a use case possible? Maybe I should use custom pages instead but How to link to such a page from a table row or and edit form?
1...420421422...484Latest