Questions tagged [fieldtypes]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
23
votes
1answer
2k views

How can my plugin generate a generic modal window in the Control Panel?

I'm working on a plugin, and it requires a modal to be displayed when the user interacts with a field of my Field Type. When the user finishes interacting with the modal, they would click "Done". ...
10
votes
2answers
2k views

How to add more options to the 'Restrict allowed file types' settings?

I am wondering what would be the best approach to add another file type to the 'Restrict allowed file types' asset field settings? For our website specification we need to have .zip files and .pdf ...
9
votes
1answer
727 views

How can I add a RichText-Field to my plugin's CP-section?

I'm trying to add a redactor richtext field to one of my plugin templates in the CP. I found macros for every field in craft/app/templates/_includes/forms, but a richtext macro is missing. I assume ...
7
votes
3answers
2k views

Default field values?

This seems so simple, but after reading over the docs, I couldn't find an answer: Is there a way to have a field have a default value in Craft? In my case, I have a Lightswitch field that I want to ...
6
votes
2answers
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 ...
6
votes
1answer
223 views

Reorder selection of categories in category fieldtype

I'm looking to reorder my selected categories within a category field. I'm hoping this is possible because the order an editor selects these categories is important, primarily for the .first() ...
5
votes
2answers
405 views

List of reserved field handles

Is there somewhere documented on what field handles are reserved? Would be great to have this as a resource here, especially for plugin development. Edit: A good place to start would be https://...
5
votes
1answer
99 views

Is there a masked input field type for Craft?

Is there anything like the EE add-on for Craft? This would be really useful for part numbers, etc.
4
votes
1answer
4k views

Link to an entry via Entries field type

I am attempting to create a "dynamic" button. By that I mean I want the user to be able to update the text and the target (href) of where the button links to when clicked. So I created fields: ...
4
votes
2answers
456 views

When creating a fieldtype how do I provide methods to be used in the templates?

I have created a fieldtype that saves a single integer to the database, it has some settings that defines the maximum value that integer can be: protected function defineSettings() { return array( ...
4
votes
2answers
1k views

Is it possible to change the time increments in the Date/Time field?

We have a date/time field shown to render the time for a series of workshops but right now Craft only increments in 30 minutes. Is there a way for us to render 15 minute increments?
4
votes
1answer
90 views

Using ElementType as field type for plugin in what way do I provide my own data to the modal?

I have been looking at the BaseElementFieldType.php file to try and understand how to use it for my own field type. How do I provide that field type with my own array of data to use? I believe it has ...
4
votes
1answer
864 views

Can I have a textarea field which isn't rich text?

I have a rich text field that I don't want wrapped in anything. I just want a text area field, but I'm not sure how to get a text area without making it rich text, as the only multiline text field ...
4
votes
1answer
431 views

Is it possible to translate the name of a field in the CP?

I have content editors that speaks different languages. Is there a way to translate the name and introduction of a field in the control panel? A simple {{ "value"|t }} seams not to work. Example: ...
4
votes
1answer
118 views

Plugin fieldtype settings for ColumnType::LongText being inserted as varchar(255)

I’m working on a plugin that includes a custom fieldtype. Using Craft 2.6.2911, the fieldtype’s defineSettings looks like this: public function defineSettings ( ) { return [ 'json_data' =...
4
votes
2answers
563 views

Color Picker with “no color” option?

I want let the editor to choose an optional color via the color picker, but this didn't have the option 'no color' (or transparent). Is there a solution to this? I use it a lot and have always to add ...
3
votes
1answer
352 views

Resource for setting up Craft CMS Fields

It's a good 7 months after the last time this question was asked. I've been developing sites for a long time, expert with Wordpress, some Drupal, Joomla when forced. I can understand a good part of ...
3
votes
1answer
331 views

How do I add a value to a tag field type using the entries service saveEntry method?

I am updating an entry using the entries service, I want to add a tag value into a tag field type (classifiedTags). $entry = craft()->entries->getEntryById(120); $entry->getContent()->...
3
votes
2answers
49 views

Which string identifiers for field types do exist?

There are several enum classes containing constants such as the SectionType class which I can use to create sections: // … $section = new SectionModel(); $section->type = SectionType::Single; // ...
3
votes
1answer
582 views

Missing Position Field Type in Matrix (Craft 3)

Anyone know how to get the Position field type to show up in Craft 3 (RC)? I have a Matrix field, and an Asset/Image field within that, and I'm trying to add a Position field to it.
3
votes
1answer
104 views

How can I make my custom FieldType show up in an element index?

I've built a custom FieldType, and I'd like editors to be able to add any fields using this FieldType to element indexes. Unfortunately, fields using my custom FieldType aren't included in the list of ...
3
votes
2answers
488 views

Target a certain entry type on the entries fieldtype

I have all of my entries as single pages, but of different types depending on the section. I need to create a field that allows users to link to another page entry, but I need to ensure they only ...
3
votes
1answer
154 views

Error: min/max value in number fields

Is there any reason why min/max value are limited to the following? [9999999999999] - Min is too big (maximum is 2147483647) I need to add ISBN numbers which are 13-digits. Is there a reason for ...
3
votes
1answer
550 views

Custom field type that has multiple fields to extend the default field types

Ok scenario that I'd like to create. Create a custom field type lets call it videos. In this field type you would have 5 separate fields title, description, caption, link, thumb. This would make up ...
3
votes
1answer
307 views

Plot absolute coordinates / Image map

I have a site where I want to set up a "tour" of a software screenshot, and I need to allow users to select points on an image to insert the tour "stops". Is there an add-on like DevDemon's Entry ...
3
votes
2answers
684 views

Submitting checkbox data from a front-end form for a 'Categories' Field Type

I have read a few docs about front-end forms such as the Checkbox field docs. Although that doc doesn't seem to give an example of what I need. I have a 'categories' field type. I am creating a ...
3
votes
1answer
25 views

Partial Dates within Craft

Is it possible to store partial dates? EG i want to create a document that covers a date range, sometimes that range could be Jan/2013 to JUN/2014 other times we may need it more specific EG 20/JAN/...
3
votes
0answers
61 views

Set default order of Custom Fields inside Layout Tab

I'm writing a custom plugin, and I want to specify a custom order of the Fields in a tab. My plugin installs several fields, and I want the user to be able to simply add the tab that contains my ...
2
votes
3answers
1k views

Plugin for entries table field

In Craft we have the table field type and each column can have a type. This field type is restricted to only text, number and checkboxes. Is there a plugin to add entries field type to the column ...
2
votes
1answer
67 views

warning icon on fields

I am seeing warning icons on drop down fields like this Where does this come from?
2
votes
2answers
137 views

Restricting relationship field by author

First site using Craft and impressed thus far. I'm going to be allowing CP access for all users, and these users will have access to multiple channels. I want them to be able to relate their entries ...
2
votes
1answer
180 views

How do I store code in Craft

I need to store Javascript/HTML code in some of our entries. I have tried to put the code in plaintext but cannot get the code to render through twig. I cannot store this stuff on the filesystem. It ...
2
votes
1answer
1k views

How to populate Category field form frontend form?

I have a frontend form that has a select list for language. This field will allow for one language to be selected. In the backend I have a field set up for my entries as a category field populated by ...
2
votes
1answer
315 views

Found cool example of Header Globals what field type is used for this?

So I was reading an article on craft, and found an example of something I am trying to do. Creating a global for header/footer links etc so they can be managed dynamically. Here is a screenshot of ...
2
votes
1answer
834 views

Field type for selecting a section (channel / structure / single)?

I have a channel for products but in some cases I would like to associate a product with a structure containing documentation and release note pages: http://mysite.com/product/my-product/docs/getting-...
2
votes
1answer
92 views

Is this Garnish message bad? “Element was added to more than one selector”

My plugin has a field type. When I'm editing an entry which uses that field type, this message gets logged to the console: Element was added to more than one selector I can tell that it's Garnish ...
2
votes
1answer
587 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 ...
2
votes
1answer
300 views

Table fields, default single empty row, and never returning as empty?

I'm having a small problem with table fields. My issue is that by default a table fields starts with one row. Even if you leave this row empty (no values at all in any column) the field will never ...
2
votes
3answers
370 views

Multiple sources on category field type - possible?

We're trying to setup a category field type to allow the selection of 1 category but from multiple category sources. Is there a simple way to achieve this without writing a custom plugin / fieldtype? ...
2
votes
1answer
61 views

Pre-fill fields when creating an entry in CP

I am using redactor plugin for my field type and I want to use global values of the same field type to be used as pre-fill value when creating a new entry. Use case: Each year there is an edition of ...
2
votes
1answer
61 views

Craft CMS 3 data structure advice for vehicle make, model, trim, year tagging

Hi i really would like some advise on best practices on setting up some data for my Craft APP. Most of my documents will be linked to vehicle make/model/trim/year. EG Audi A5 Sport 2009-2016 and/Or ...
2
votes
1answer
39 views

Show on user profile page the commissions he is connected to

I have a commissions section in where we have a matrix field where we add the user (from craft.users) and the function of the user. A user can be in more that one commissions. On the user profile ...
2
votes
1answer
133 views

Odd error message when editing field settings (Variable “targetLocaleFieldHtml” does not exist)

After upgrading a site from 2.4.x to 2.6.x, I'm experiencing an odd issue where Craft throws the following template error whenever I attempt to edit a field: Variable "targetLocaleFieldHtml" does not ...
2
votes
1answer
765 views

Model and its behaviors do not have a method or closure named “optgroup”

I'm attempting to finish my first fieldtype plugin (how exciting!) but having an issue with displaying options in a select dropdown in an entry. My ColumnWidth_WidthsFieldType has this: <?php ...
2
votes
1answer
37 views

Categories field that allows duplicate values

I have a categories field where I would like to be able to include the same category more than once. Any suggestions on how to do this?
2
votes
1answer
109 views

Plugin Development: find source group used by field

I'm writing a plugin that works with Fields in various ways, one thing I need to do is get the category source groups available to a particular category field. I have the field's handle and id and can ...
2
votes
1answer
400 views

Dynamic placeholder text in 'Plain text' field type

I have a plain text field that encourages content editors to write a more detailed description of a piece of content. However, on the front-end the template will use the post title by default if this ...
2
votes
1answer
60 views

Venti fieldtype bug [closed]

I've added a Venti fieldtype to an entry and when I try to save it as an all-day event it says Couldn't save entry Start Date and time must be set. End Date and time must be set. Help appreciated!
2
votes
1answer
813 views

Limit characters in redactor wysiwyg field

I'm trying to limit the amount of characters by adding the 'limiter' plugin to the redactor field which can be found here: http://imperavi.com/redactor/plugins/limiter/ I've added the limiter.js ...
2
votes
1answer
659 views

Is it possible to create a field group that can be modified across entry types?

Sorry if this is asked/answered elsewhere. I tried to search for it with no success. Suppose I have a common group of fields that I want to include in different entry types, and each entry will have ...