This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
lucas.sanner54070
Let's say I have set the following field in my fields.yaml file:
my_field:
label: My field
type: partial
path: ~/plugins/vendorname/pluginname/models/post/_mypartial.htm
Now is it possible to retrieve the model from my partial ? Something like $this->getModel()
?
Last updated
mjauvin
The model can be referenced in the partial as follow:
<?php $model ?>
or
<?php $formModel ?>
The field as:
<?php $field ?>
or
<?php $formField ?>
and the field value as:
<?php $value ?>
or
<?php $fieldValue ?>
Last updated
mjauvin
Also, you can shorten your path definition with the "$" symbol which refers to the plugins folder by itself.
path: $/vendorname/pluginname/models/post/_mypartial.htm
1-6 of 6