Questions tagged [custom-fieldtype]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
8 votes
2 answers
2k views

How does a plugin include it's own config options?

When building a plugin, how does one define user editable config files? Would it be better to create a settings UI in the plugin and have the user edit those variables in the CP? Or is there a way to ...
5 votes
1 answer
1k views

How to reference the current entry element in custom Control Panel templates?

This might provide it's own answer, but I thought I would ask to be sure. How do you reference the current entry in custom fieldType or CP templates? I have tried {{ entry.id }}, {{ element.id }} but ...
2 votes
2 answers
929 views

Add an assets field to a field type plugin template

I have a plugin that creates custom field types to extend crafts default field types. The custom field types hold several different form input fields. For example the field may be called video and ...
  • 2,023
4 votes
1 answer
1k views

How to use the native datepicker ui in custom fieldTypes?

I would like to impliment the native craft datepicker ui in my custom fieldType. From looking at the native date template (craft/app/templates/_includes/form/date.html) I can see that it inserts ...
7 votes
3 answers
17k views

How do I prevent Twig from encoding HTML?

I've created a field type that stores its value as a model. That model’s __toString() method returns the result of a craft()->templates->render() call: public function render() { $render = ...
  • 163
2 votes
1 answer
828 views

More than one field for a fieldtype plugin

I can have many 'settings' fields for a fieldType and they're saved as a serialized string in the database. Is it possible to have more than one field for the fieldType itself? It looks like there's ...
4 votes
1 answer
3k views

How to create custom field type in Craft 3

I have been struggling to create my own custom field, so I would like to ask how to create it. First of all, I don't know where the files should be in. I have some custom fields in Craft 2. It might ...
  • 401
3 votes
2 answers
243 views

How do you customize what value a Custom FieldType returns to a template

Is it possible to control what gets output in the template a custom fieldtype? For example im working on a eventbrite plugin and it saves the id in the database but I want the field in the template ...
1 vote
0 answers
123 views

Element type vs. Field type - or: Element type without database storage?

I have already searched for information on this topic but I did not find much. I hope I did not overlook something. My problem is the following: I want to try to write a plugin that lists entries ...
  • 481
6 votes
2 answers
2k views

Custom Field Type with Multiple Values

I'd like to create a field type for my plugin called "location" with two text boxes: one that holds a coordinate for latitude, and one for longitude. I haven't figured out yet how to map those two ...
  • 163
5 votes
1 answer
835 views

Is there a way to generate a url to an image in the craft/storage/myplugin directory?

I am generating dynamic images to a directory in craft/storage. I need to be able to use these generated images on the front-end inside templates. Is there a helper method for this, or some way to use ...
3 votes
1 answer
990 views

Can You Make a Custom Field with multiple columns?

I have a custom field where I'm defining AttributeType::Mixed in order to achieve the affect of saving multiple pieces of data for a single field. The data gets stored as JSON as expected. Quick ...
  • 491
1 vote
1 answer
49 views

Structure Navigation with 3 possible Link Types using Nav tag

I'd like to build a Structure that can be used to output the main site navigation; each "entry" in the Structure would have three custom fields (types): Category, Entries, URL This question ...
1 vote
1 answer
588 views

How can I add attributes to craft field?

In my template I have this, {{ craft.fields .getFieldByHandle('ethnicOrigin') .getFieldType() .getInputHtml( 'fields[ethnicOrigin]', '') | raw }} which returns me a <select> ...
  • 427