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

    pboivin

    08/13/2021, 6:25 PM
    Hey @User , You're right, this a part of Twill that is not really extensible out of the box but I'm pretty sure will be in the future. For now, one possible way to override Twill built-ins would be via composer configuration :
    Copy code
    "autoload": {
            ...
            
            "files": ["app/Models/Enums/UserRole.php"],
            "exclude-from-classmap": ["vendor/area17/twill/src/Models/Enums/UserRole.php"]
        }
    You can use the files/exclude-from-classmap keys to replace some of the internals.
  • p

    pboivin

    08/13/2021, 6:56 PM
    I can't decide if this is cleaner than overrides, but maybe https://github.com/cweagans/composer-patches is worth looking into. This allows you to maintain a small set of patches, in your projet, against your composer dependencies.
  • g

    Ge1i0N

    08/13/2021, 7:54 PM
    Thank you very much for your reply. I will study this and write whether I managed to do what I want or not.
  • s

    sapta34

    08/14/2021, 5:45 AM
    I have added WYSIWYG in the block editor. But can't understand how i render this in frontend. I have tried both the {!!$child->input('addressblock')!!} and {!!$child->translatedinput('addressblock')!!}
  • g

    Ge1i0N

    08/14/2021, 5:49 AM
    Try to write $block instead of $child
  • s

    sapta34

    08/14/2021, 5:54 AM
    ok
  • s

    sapta34

    08/14/2021, 5:56 AM
    Thanks ... Yes the problem solved ..
  • g

    Ge1i0N

    08/14/2021, 8:04 AM
    This actually solved my problem, thanks! I'll wait for the custom fields translation functionality to work out of the box. However, the current solution is acceptable. It would be ideal if I could inherit from the original class instead of copying it. But in the current architecture this is not possible, as I understand it. Thanks again!
  • l

    leftblank

    08/16/2021, 3:50 PM
    Hi all - I've implemented column ordering on a relationship field as per the docs, but i'm seeing a Javascript error if i first order by Title and then order by the relationship field - the AJAX call looks to be returning data in the correct order, but looks like the front-end is getting confused and stops working with a JS error
  • l

    leftblank

    08/16/2021, 3:50 PM
    Reloading and just ordering by the relationship field (asc and desc) works fine though
  • l

    leftblank

    08/16/2021, 3:52 PM
    Any ideas what this might be?
  • p

    pboivin

    08/16/2021, 4:32 PM
    Hey @User , curious to know what kind of relationship field this is. Is it a belongsTo?
  • l

    leftblank

    08/16/2021, 4:32 PM
    Hey @User - yes it is
  • p

    pboivin

    08/16/2021, 4:39 PM
    Interesting. I'm not able to replicate this issue but maybe I'm missing something. The JS backtrace from the dist bundle is a bit difficult to follow 😅 , would you be able to retest in dev mode? (I can help you setup if needed) But first, I guess, can you share your
    order()
    and
    scopeOrderByX()
    implementations? Just to double check.
  • l

    leftblank

    08/16/2021, 4:41 PM
    Sure - I have a Range model, which belongsTo a Supplier. So i'm trying to order ranges by the supplier column
  • l

    leftblank

    08/16/2021, 4:41 PM
    in RangeRepository, I have:
  • l

    leftblank

    08/16/2021, 4:41 PM
    Copy code
    public function order($query, array $orders = [])
        {
            if (array_key_exists('supplierTitle', $orders)){
                $sort_method = $orders['supplierTitle'];
                unset($orders['supplierTitle']);
                $query = $query->orderBySupplier($sort_method);
            }
    
            return parent::order($query, $orders);
        }
  • l

    leftblank

    08/16/2021, 4:42 PM
    and in Range model, I have:
  • l

    leftblank

    08/16/2021, 4:42 PM
    Copy code
    public function scopeOrderBySupplier($query, $sort_method = 'ASC')
        {
            return $query
                ->select('ranges.*', 'suppliers.id', 'suppliers.title')
                ->leftJoin('suppliers', 'ranges.supplier_id', '=', 'suppliers.id')
                ->orderBy('suppliers.title', $sort_method);
        }
  • p

    pboivin

    08/16/2021, 4:44 PM
    Thanks. Looks good, pretty straightforward 🙂 So, shall we try dev mode?
  • l

    leftblank

    08/16/2021, 4:45 PM
    Haha yes - guiding me through this would help please, never done it before 🙂
  • p

    pboivin

    08/16/2021, 4:46 PM
    Sure! Let's jump onto a thread.
    l
    • 2
    • 73
  • i

    Ivan Markov

    08/17/2021, 9:23 AM
    Hi everyone. Have you ever encountered a similar error? Using Glide locally. GLIDE_DRIVER=imagick. Imagick has svg support
  • i

    ifox

    08/17/2021, 9:37 AM
    Hi @Ivan Markov, actually intervention image, with any driver, doesn't really support SVG, though it should still render something, I'm not sure what is producing your error. A recent PR has been merged in 2.x to support returning raw SVG urls instead of trying to render them through Glide. https://github.com/area17/twill/pull/985/files
  • i

    Ivan Markov

    08/17/2021, 9:46 AM
    @User The weird thing is that on my local server (docker) svg shows.
  • i

    ifox

    08/17/2021, 9:50 AM
    It shows, as a jpg
  • i

    ifox

    08/17/2021, 9:50 AM
    your error seems to be a permission issue more than anything
  • i

    ifox

    08/17/2021, 9:51 AM
    but i wanted to clarify that actual SVG would not render as such, Glide renders them as jpg/png
  • v

    void

    08/18/2021, 5:18 PM
    finally got some time and back to Twill
  • v

    void

    08/18/2021, 5:19 PM
    But I really can't get a custom Vue Component to work
1...787980...484Latest