This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Bhargav
Bhargav

How can I customise the relationRender in the Preview page.

The docs have no mention of other than to say thay we can display it https://octobercms.com/docs/backend/relations#relation-display

<?= $this->relationRender('phone') ?>

I found this ( https://octobercms.com/forum/post/recordfinder-and-ability-to-add-new-items ) in the forum. But is it ok to change the core files like that

cydrick.nonog
cydrick.nonog

Hi you can do this.

In your model fields.yaml add a field that the type is partial

example:

fieldnameorrelationname:
    type: partial

Now add another file named _fieldnameorrelationname.htm inside your controller partials inside that file

add this line

<?= $this->relationRender('relationname') ?>

Last updated

Bhargav
Bhargav

Thanks that worked.

Bhargav
Bhargav

How can i set the default create option to be the current value.

What i'm trying to build is a client, contact relation. I have a list of clients and each client has many contacts.

When i click on Create Contact in the relationRender in the client preview page a pop up to create a contact is showing up.

How can I set the default client relation be the current client in the dropdown?

WaskiWabit
WaskiWabit

I would like to know how to do this as well. My best guess is that you would have to set it somewhere inside the controller. Perhaps overriding the default model value. Whatever it may be.

1-5 of 5

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.