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

    jefsev

    03/15/2023, 10:38 AM
    I think so, i will double check.
  • j

    jefsev

    03/15/2023, 10:38 AM
    Did not know that thanks,
  • Additional props to repeater component
    e

    Edex

    03/15/2023, 3:23 PM
    Can I send additional data to a repeater form view?
    k
    • 2
    • 17
  • c

    Constant Variable

    03/15/2023, 5:23 PM
    Hello, I'm tring to import an Old DB to Twill, I'm actually using seeder for this, it works pretty well for the "main table" but how can I save the content to the Translations & Slugs tables also ? My code actually looks like this.
    Copy code
    // Import articles
            $connection
                ->table('articles', 's')
                ->orderBy('s.id')
                ->chunk(1000, function ($articles) {
    
                    foreach ($articles as $oldarticle) {
                        // dd($oldarticle);
                        $oldarticle = (array)$oldarticle;
                        $article = new Article();
                        $article->id = $oldarticle['id'];
                        $article->created_at = $oldarticle['created_at'];
                        $article->updated_at = $oldarticle['updated_at'];
                        $article->published = $oldarticle['published'];
                        try {
                            $article->save();
                        } catch (QueryException) {
                            echo "article " . $article->id . " could not be saved" . PHP_EOL;
                        }
                    }
                });`
    I tried something like this as mentioned in Translatable but it doesn't work.
    Copy code
    $data = [
                            'id' => $oldartist['id'],
                            'first_name' => $oldartist['first_name'],
                            'last_name' => $oldartist['last_name'],
                            'en' => ['text' => 'My first post'],
                            'fr' => ['text' => 'Mon premier post'],
                          ];
                    
                            $artist = Post::create($data);
    Thanks for your help
  • v

    Vouga

    03/15/2023, 7:52 PM
    Hey!!! I'm trying Twill but i'm having a problem with the images. All my uploaded images are PNG but when I use them ($brand->image('cover', 'default')) I get JPEG versions. Where can I change the behaviour? Thanks u
  • i

    ifox

    03/16/2023, 12:17 AM
    Hi @Vouga assuming you're using Glide for image rendering, you would use the
    glide.default_params
    key in the
    twill.php
    config file, see https://github.com/area17/twill/blob/61f34bd011d115e490329d0e24b220de491bcd53/config/glide.php#L23
  • i

    ifox

    03/16/2023, 12:21 AM
    Hi @Constant Variable you're missing the 'active' boolean column in the translated fields in the approach with locale keys in the data array. But to properly import into twill I'd recommend using your twill module repository class. You can check what a form submission looks like in twill for that module and pass exactly the same data structure to the repository create or update methods
  • c

    Constant Variable

    03/16/2023, 8:07 AM
    Hello @ifox , thanks for the quick answer. Ok, I will investigate the module repository way.
  • Conditional fields with browsers
    h

    Hip-Hop

    03/16/2023, 9:42 AM
    Good afternoon. Please tell me. I use Conditional Fields. Is it possible to extract data from an attached article? And on the basis of this data, load a select with certain data? For example, I loaded an article in the browser component. If in this article, for example, the checkbox is checked, then display the select with the parameter "dark color", and if the checkbox is not checked, then display the select with the parameters "dark", "light"
    i
    • 2
    • 3
  • Twill packages
    j

    jefsev

    03/16/2023, 9:57 AM
    Quick question about twill packages. it is extended with TwillPackageServiceProvider Normally i would need to boot for example my migrations: https://laravel.com/docs/9.x/packages#migrations $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); I see that TwillPackageServiceProvider takes care of a lot already if using a Capsule. Are views or components also taken care of with TwillPackageServiceProvider I see blocks and repeaters but i gues that's for the Twill CMS side not the frontend. Say i create a resources folder in my capsule where i add a component and some javascript, is that the only thing i need to boot in my service provider?
    i
    • 2
    • 9
  • Auto cropping
    n

    Nechalon

    03/16/2023, 11:52 AM
    Can the image auto cropping feature be customized or adjusted?
    i
    • 2
    • 16
  • e

    Erwin

    03/16/2023, 1:18 PM
    Hey is there a specific working example on how to use the preview functionality in a headless context with nextjs or any other js frontend framework?
  • i

    ifox

    03/16/2023, 1:21 PM
    Hi @Erwin this is coming alongside the Twill 3 release, as a nuxtjs example. Essentially you need to put your frontend app in the preview iframe and pass a token or directly the previewed data depending on how your app is receiving the CMS data.
  • e

    Erwin

    03/16/2023, 3:39 PM
    Thanks! Ill try to make it work
  • j

    JonathanF

    03/17/2023, 8:53 AM
    Hey, just a quicky, the link in this section (https://twill.io/docs/form-fields/browser.html#using-browser-fields-and-custom-pivot-tables) no longer works. Is this tutorial hosted somewhere else?
  • k

    kalle

    03/17/2023, 9:12 AM
    Unfortunately no, Spectrum is dead a few months already. They provided no promised backup on Github discussions.
  • j

    JonathanF

    03/17/2023, 9:14 AM
    Thanks @kalle, I'll maybe create a #1029411044516438110 thread asking how to.
  • n

    Nechalon

    03/17/2023, 9:45 AM
    Hi, How can I add a new tab inside the admin dropdown/settings?
  • i

    ifox

    03/17/2023, 10:00 AM
    @Nechalon you can override the
    _user.blade.php
    partial
  • n

    Nechalon

    03/17/2023, 10:10 AM
    You mean the dropdown itself? I want to add a tab inside settings where the current user gets printed out
  • i

    ifox

    03/17/2023, 10:11 AM
    I'm not sure what you mean by tab and settings, can you share a screenshot with an arrow or something
  • Custom navigation under user settings
    i

    ifox

    03/17/2023, 10:28 AM
    I'm afraid this isn't possible without an override of the internal UsersController
    n
    • 2
    • 6
  • i

    ifox

    03/17/2023, 10:13 AM
    Ok makes sense
  • j

    jefsev

    03/17/2023, 10:14 AM
    Hi if i want to use the twill 3 Block component class to register my blocks inside a package. https://github.com/area17/twill/blob/3.x/docs/content/1_documentation/5_block-editor/02_creating-a-block-editor.md In what folder structure would i than put the block file, the docs say for normal twill project it is: App\View\Components\Twill\Blocks In my package i have a capsule, so i would like to add the blocks to the capsule using the Block component class so that it works with the TwillPackageServiceProvider if possible 🙂
  • j

    jefsev

    03/17/2023, 10:17 AM
    found it i think 😛 \A17\Twill\Facades\TwillBlocks::registerComponentBlocks('\\Your\\Namespace\\Components\\Twill\\Blocks', __DIR__ . '/../../path/to/namespace');
  • j

    jefsev

    03/17/2023, 10:19 AM
    Is registering module fields using the controller ( public function getForm(TwillModelContract $model): Form ) only possible in twill 3 or also twill 2?
  • n

    Nechalon

    03/17/2023, 10:20 AM
    yees, so what can I do about it? 😄
  • i

    ifox

    03/17/2023, 10:29 AM
    getForm
    is new in Twill 3
  • j

    jefsev

    03/17/2023, 10:30 AM
    Oke thanks 🙂
  • Twill 3 vs Statamic
    a

    Aidas (KasValgyt)

    03/17/2023, 10:40 AM
    Hi, our company is planning to build a new tool for content management and it's going to be used a lot. It will need a lot of customisation and we are planning to use it for a long time. We are currently choosing between twill v3 and statamic. Statamic looks like a more mature product with paid long term support compared to twill and statamic has a code coverage close to 100%. So on paper statamic sounds like a better choice. Maybe you guys have experience with statamic and maybe there are some limitations which are not aparent with twill? Would love to hear some opinion. Maybe working with statamic is hard or something. We will be using database of course, nothing will be static, so we don't need these static pages and caching features from statamic, but what I can see from documentation statamic works great with databases too and I hope it can be as dynamic as twill. e.g. I hope we will be able to render each page block with custom php code and tailor block experience based on customer data. Anyway, hope you can help us to make this big decision as we will be willing not only to use this software but also to contribute to this community.
    i
    • 2
    • 6
1...479480481...484Latest