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

    Sami

    08/31/2022, 2:30 PM
    it doesn't matter in this case but I'd like to understand how to control that
  • h

    Harings Rob

    08/31/2022, 2:31 PM
    It is a bit tricky for the name "name" but I am sure that we can work around that if needed.
  • h

    Harings Rob

    08/31/2022, 2:32 PM
    Copy code
    php
    - `renderHtml(bool $html = true)`: If the cms should render the contents as html. (Be careful when using this with
      unprotected data sources.)
    - `customRender(Closure $renderFunction)`: A closure with a custom render function instead of using the raw field value.
    - `linkCell(Closure|string $link)`: A closure or string on where to link the field contents to.
  • h

    Harings Rob

    08/31/2022, 2:32 PM
    Maybe with some of these.
  • h

    Harings Rob

    08/31/2022, 2:32 PM
    We could also opt to remove the automatic front-end linking as a whole in 3.x as it can be fully controlled from the back-end.
  • s

    Sami

    08/31/2022, 2:37 PM
    tried to set
    renderHtml
    to false, still linking whatever
    customRender
    returns, still link tried to return
    null
    in
    linkCell
    , still leads to edit form 😅
  • k

    kalle

    08/31/2022, 2:41 PM
    You can use mutators to alias fields to something else than
    name
    Copy code
    php
    public function getNewNameAttribute()
    {
        return $this->attributes['name'];
    }
  • h

    Harings Rob

    08/31/2022, 2:46 PM
    yea @Sami I will need to adapt the front-end code to no longer link, if you can create an issue I will take care of that
  • s

    Sami

    08/31/2022, 2:46 PM
    Oh okay, I didn't quite get that the literal
    name
    column is the problem 😅 I thought it has something to do with
    titleColumnKey
  • s

    Sami

    08/31/2022, 2:46 PM
    okay, I understand now
  • k

    kalle

    08/31/2022, 2:53 PM
    Im probably wrong here since this field naming doesnt affect frontend rendering. Can you show us the current code which triggers link rendering? Does your
    indexColumns
    contain table column
    name
    ?
  • s

    Sami

    08/31/2022, 2:55 PM
    I don't think you are. Tried to change the attribute
    name
    to something else and the links are gone
    indexColumn
    was renamed but seems like it doesn't have any impact on the links
  • s

    Sami

    08/31/2022, 2:56 PM
    done
  • h

    Harings Rob

    08/31/2022, 2:56 PM
    Perfect, then it cannot be forgotten 🙂
  • s

    Sami

    08/31/2022, 3:36 PM
    When in
    block_editor
    context,
    $block->image('role', 'crop')
    doesn't find the media. However outside of the context it works correctly. Can this be related to Twill 3? I noticed the
    $block
    only has
    type
    ,
    content
    and
    editor_name
    attributes. Maybe that's why it can't load relationships correctly?
  • h

    Harings Rob

    08/31/2022, 4:21 PM
    The way blocks work should be the same as before. Are we talking about the form context or the rendering process?
  • s

    Sami

    08/31/2022, 4:43 PM
    form context
  • h

    Harings Rob

    08/31/2022, 4:44 PM
    And you added the crop in your block_editor config key? Please make sure the name of your block crops do not overlap with those of model crops as that may lead to unexpected behaviour.
  • s

    Sami

    08/31/2022, 4:49 PM
    Yes, the crop is in twill.block_editor
    Copy code
    php
    'block_editor' => [
        'use_twill_blocks' => [],
        'crops' => \App\Utilities\Crops::BLOCK_EDITOR,
    ],
    Crops
    Copy code
    php
    const BLOCK_EDITOR = [
        'text_image' => self::ORIGINAL,
        'gallery' => self::LANDSCAPE,
    ];
    Block (text.blade.php)
    Copy code
    php
    <x-twill::medias 
            name="text_image" 
            label="Image" 
            note="..." 
        />
    this line
    $block->image('text_image', 'original', ['q' => 100, 'w' => 800])
    returns blank image (in block editor context) however the image seems to be saved correctly in database and is also loaded to the form preview. And can be loaded outside the block editor
  • o

    onepiece

    09/01/2022, 12:36 PM
    hello
  • o

    onepiece

    09/01/2022, 12:36 PM
    I'm trying to build a custom template, but when I try to add a vuejs component inside @section, nothing comes up.
  • o

    onepiece

    09/01/2022, 12:36 PM
    My blade
  • o

    onepiece

    09/01/2022, 12:36 PM
    @extends('admin.layouts.free') @push('extra_css') .v-application div, td, th { vertical-align: middle !important; } @endpush @section('content') @stop @push('extra_js') @endpush
  • o

    onepiece

    09/01/2022, 12:37 PM
    and my vue file
  • o

    onepiece

    09/01/2022, 12:38 PM
    / export default { data() { return { search: '', headers: [ { text: 'Dessert (100g serving)', align: 'start', sortable: false, value: 'name', }, { text: 'Calories', value: 'calories' }, { text: 'Fat (g)', value: 'fat' }, { text: 'Carbs (g)', value: 'carbs' }, { text: 'Protein (g)', value: 'protein' }, { text: 'Iron (%)', value: 'iron' }, ], desserts: [ { name: 'Frozen Yogurt', calories: 159, fat: 6.0, carbs: 24, protein: 4.0, iron: '1%', }, ], } }, }
  • i

    ifox

    09/01/2022, 12:44 PM
    Hi @onepiece, where did you put that Vue file and did you rebuild your Twill assets?
  • i

    ifox

    09/01/2022, 12:44 PM
    (btw you can use ``` on discord to format code)
  • i

    ifox

    09/01/2022, 12:45 PM
    custom components are prefixed by
    a17-
  • o

    onepiece

    09/01/2022, 12:46 PM
    My Vue file i put in assets/js/components
  • i

    ifox

    09/01/2022, 12:46 PM
    try
    <a17-app-leads>
1...381382383...484Latest