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

    moses

    10/11/2022, 9:23 AM
    Hi @ifox I mean I drag them up or down. The order is correctly saved on the editor but no change on the view or page.
  • i

    ifox

    10/11/2022, 9:26 AM
    So you mean that when you're displaying them on the frontend they are not in the order you've selected in the CMS UI? In that case can you share how you're accessing the repeater rows? You probably need to add orderBy('position') or sortBy('position') depending on the context (eloquent vs collection)
  • m

    moses

    10/11/2022, 9:29 AM
    I am not accessing the repeater row via an eloquent model. I am using the method described in the doc here: https://twill.io/docs/block-editor/adding-repeater-fields-to-a-block.html
  • i

    ifox

    10/11/2022, 9:31 AM
    @moses the docs is missing content about how to render repeaters within a block from what I can see. if you use $block->children, the position should be correct. If you have multiple repeater types in the same block you need to filter children by type, but most likely you have a single repeater in your block.
  • h

    Hip-Hop

    10/11/2022, 9:32 AM
    @Harings Rob While looking for a solution to the problem, I was able to achieve the following. In the validation method, I get the field I need with the content (commented out in the picture) Further I want to receive contents through a name of a field. I registered repeater_index in the rules and got the contents of the array. But I can't get the fields any further. Through concatenation it is impossible to deduce the necessary field.
  • m

    moses

    10/11/2022, 9:43 AM
    I have something like this in my view:
    Copy code
    @foreach($block->children as $child)
       @if ($child->type == 'repeater_type_I_am_interested_in')
       ...//display child->property
  • i

    ifox

    10/11/2022, 9:45 AM
    The children relation on the block model is already ordered by position so this is strange https://github.com/area17/twill/blob/293a06d521c45ff833246fda41ca7885a0a41983/src/Models/Block.php#L49
  • m

    moses

    10/11/2022, 9:48 AM
    Yeap! it's strange 🙂 . I will have a closer look again. Maybe I miss something
  • h

    Hip-Hop

    10/12/2022, 8:06 AM
    @ifox Good morning. Can I ask you how to check the field in the repeater in the block?
  • s

    Sami

    10/12/2022, 11:17 AM
    Hello, I'd like to do something everytime a User logs into the administration. Does Twill have any events for that? If not, I think the way would be to override Twill user model with custom user and use
    boot
    method for that. Does it make sense? EDIT: No, it doesn't. User is booted every request. I solved this using the
    boot
    function in combination with session but I'm not happy.
  • a

    asolopovas

    10/12/2022, 12:20 PM
    Hi Everyone, guys after updating to 2.9.1 from 2.6.0 all models that I have lost connection with medias, database hasn't changed all connections seem to be there but medias comeback with empty collections. Have I missed something when upgrading is there a guide for migration?
  • a

    asolopovas

    10/12/2022, 12:21 PM
    If I reupload images everything works as it should
  • a

    asolopovas

    10/12/2022, 12:23 PM
    Use laravel events to track all actions, at the end of the day twill is built on top of laravel so you have all the power. https://laravel.com/docs/9.x/events#main-content
  • a

    asolopovas

    10/12/2022, 12:28 PM
    it seems like in my case media_type column changed from App\Models\Page to pages
  • s

    Sami

    10/12/2022, 12:28 PM
    I've read through that already. But since Twill doesn't provide any events I'd still have to override something from Twill to dispatch the events myself. Am I wrong?
    i
    k
    • 3
    • 6
  • k

    kalle

    10/12/2022, 1:31 PM
    Hmm this soon could be implemented, but its targeted for 3.x version. My PR is waiting, but hell I dont have a time to finish this.
  • i

    ifox

    10/12/2022, 10:19 PM
    that would happen if you started to use a morphmap for your Page model, did you make that change while updating Twill, maybe?
  • d

    dakaalim

    10/13/2022, 2:43 AM
    Can we change the URL of the logo on the top left side
  • d

    dakaalim

    10/13/2022, 2:43 AM
    and favicon
  • h

    Hip-Hop

    10/13/2022, 3:05 AM
    Good morning. Can i ask you? Is there some method that allows you to remove tags before field validation from WYSIWYG? For example, I have a requirement that only numbers can be entered in WYSIWYG and that they can be formatted (bold, etc.) It can be done through a regular expression, but I have a lot of fields using this editor. So I think that in order not to write regular expressions, it may be possible to somehow exclude tags when checking.
  • h

    Hip-Hop

    10/13/2022, 4:09 AM
    I decided to create my own rule for validation, but they are not supported in the block class
  • h

    Hip-Hop

    10/13/2022, 4:09 AM
    expression is not allowed as field default value
  • u

    uwascan

    10/13/2022, 12:10 PM
    Greetings! I have a custom block class and I have extended the
    getData(array $data, \A17\Twill\Models\Block $block): array
    method. How do I access custom block data (added to the default $data array by my Block class) from a view?
  • u

    uwascan

    10/13/2022, 12:12 PM
    Is it Possible to make a block_editor content edit only to prevent accidental removal blocks as the structure of each Page is determined by the blocks I added at dev time
  • i

    ifox

    10/13/2022, 12:17 PM
    @uwascan if the structure of the page is determined you should not use blocks to control that part of the page. I definitely see the use case though and we could easily add an option to prevent deleting blocks. See this guide for something similar to what you're doing https://twill.io/docs/guides/prefill-block-editor-from-template.html
  • i

    ifox

    10/13/2022, 12:19 PM
    the keys you return in the array from getData should be available as variables in your blade file
  • i

    ifox

    10/13/2022, 3:28 PM
    we'll need to look into this, thanks for flagging
  • i

    ifox

    10/13/2022, 3:29 PM
    which logo do you mean? the app name?
  • i

    ifox

    10/13/2022, 3:29 PM
    you can override view partials from twill to change anything you'd like
  • y

    Young_Koekwaus

    10/13/2022, 5:39 PM
    Can anyone help me out ?
1...414415416...484Latest