Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [fieldtypes]

The tag has no usage guidance.

2
votes
1answer
14 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 ...
1
vote
1answer
23 views

Commerce discount promotions as a fieldtype?

I'd like to create an entry in Craft that talks about a new discount, and then choose that discount via a field (so a bit like you can choose an entry or a product). That way, should the parameters of ...
3
votes
1answer
21 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/...
2
votes
1answer
24 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 ...
1
vote
2answers
35 views

How to Access the Twig Attribute Name from the Fieldtype Class

I want to be able to output different values for my fieldtype depending on the twig attribute. So {{ entry.myField }} would output AK by default, but {{ entry.myField.label }} would output Alaska. ...
1
vote
1answer
31 views

Custom Field Settings: Unknown Property Error

I have a custom field with a setting for regionType, but when I try to save the field I get this error: Setting unknown property: kgrote\siteutilities\fields\Regionselect::regionType In my ...
0
votes
0answers
10 views

Type number form in textField for plugin

I haven't found any fields that deal with numbers for a plugin. I've changed a forms.textField into a type:number which has seemed to work fine for the most part. But I can't find a way to keep ...
1
vote
1answer
36 views

Where does Craft store the field definitions?

I would like to add field and section definitions to versioning. Or at least, have them backed up constantly. I haven't been able to find out yet how craft handles this. I'd say it's in the database, ...
1
vote
1answer
44 views

How can I get the type of a field using Twig?

I would like to loop through all the fields of a field layout tab form the current entry. This is working fine to get the field name and value: {% for fieldLayoutField in entry.getFieldLayout()....
1
vote
1answer
35 views

Custom Pluging Entries FieldType

I have 2 plugins I created that store similar data: Plugin 1: id, name, panel_id, price Plugin 2: id, name, test_id, price I want to attach my plugin data to an entry, and I need to make sure they ...
2
votes
1answer
39 views

warning icon on fields

I am seeing warning icons on drop down fields like this Where does this come from?
1
vote
2answers
124 views

How can I get entry id in field

I create a new filed type and attached it to entries. Now I need to get the entry id which the field is attached to. I tried $this->element in my field class, but got an error said that I'm ...
1
vote
0answers
27 views

How do you include an “Add element” button to the element selector modal

In my plugin's field types I am extending the BaseRelationField. How do you activate the "Add Element" button that shows in the Element Selector modal when the element is double clicked?
1
vote
1answer
66 views

Is it possible to use an existing field into a matrix?

I'm trying to reuse a dropdown field inside of a matrix. I've already created a field which has hundreds of dropdown values. I want to be able to select from this dropdown field for each item of a ...
3
votes
1answer
342 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
60 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 ...
0
votes
1answer
44 views

How to display all fields for an entry within an entry field type?

I've got a portfolio site I'm building, and on each project's page I'm wanting to show a list of people who worked that project. I created a channel section called "work" with an entry field type ...
2
votes
0answers
68 views

Custom fieldtype to add text field to dropdown, radiobuttons and checkboxes

In my plugin I need to create a fieldtype of a dropdown, radiobutton or checkbox combined with a textfield. I've gone ahead and created a custom field type using the description here https://craftcms....
1
vote
1answer
281 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 ...
7
votes
1answer
191 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() ...
1
vote
1answer
45 views

Is there a fieldtype in Craft like “Content Elements” or “Bloqs” for ExpressionEngine?

I have been using EE for over 5 years now, and am just starting to get into Craft (and I love it!). In my recent EE sites, I've used Content Elements, and it has been a great way to give my clients ...
2
votes
1answer
410 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 ...
1
vote
1answer
210 views

How to get Category URL from field in Matrix

This is my Matrix set up: I'm stumped to how to get the Categories URL. {% for block in entry.galleriesItem %} {% switch block.type %} {% case "galleriesItem" %} <a href="...
1
vote
1answer
153 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 ...
3
votes
0answers
48 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
1answer
35 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 ...
4
votes
1answer
80 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' =...
3
votes
1answer
77 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 ...
1
vote
1answer
127 views

map values from checkbox field into category field using SQL

In a project I have a checkbox field called gradeLevels with 3 options (k-5,6-8, and 9-12). Due to design changes, I need to convert this field into a category field. I've made a new category with ...
2
votes
2answers
119 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 ...
1
vote
0answers
41 views

The fieldtype class “insert fieldtype class here” could not be found

I'm specifically having this issue with Sprout SEO, but I would imagine the problem would persist across any plugin, given whatever solution is used. Anywho, so I've got three environments - dev, ...
3
votes
1answer
286 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()->...
2
votes
1answer
112 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 ...
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; // ...
2
votes
1answer
55 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!
1
vote
1answer
201 views

Using elementSelect for third-party elements

I'm writing plugin to extend Craft Commerce and I want to present a good way to select products in CP. I know I could use dropdown select for this, but using Craft's elementSelect would make the UI ...
6
votes
1answer
231 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://...
1
vote
1answer
603 views

amforms: display form field

I'm trying to output an amform in a template that has been selected from a Form field. From the amform docs, it says: {{ craft.amForms.displayForm('formHandle') }} My matrix fieldname is called ...
0
votes
1answer
101 views

How can I get the correct label of a dropdown that has matching values?

I have a drop-down field in the CP - It represents a range of numbers that are based either a percent or a fixed number. For example, a choice could be Fixed 5% or a choice could be Variable 5% In ...
1
vote
1answer
382 views

Is it possible to merge entry parameters to create a dynamic field handle?

I'm trying to merge a field name prefix with entry.section to make a dynamic field handle. I'm guessing I'm setting the sectionMatrix variable incorrectly, causing the code to fail without error. Any ...
4
votes
2answers
369 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
340 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 ...
1
vote
1answer
195 views

Categories on a Front-end form

I have searched the forum and cannot find the answer to my question. I know how to populate a dropdown with the categories that are already in the system, but what happens if the category that needs ...
1
vote
1answer
617 views

Update User “Field Type” for Entry in Plugin

I have a channel called "Groups", with a users field type called members for the entries. I need to be able to add/remove users to the members entry field via plugin. What I've tried is: // criteria ...
2
votes
1answer
111 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 ...
1
vote
1answer
144 views

Find Dropdown Option Labels That Are Assigned in a Section

I can get a list of option labels available in a dropdown field using the code below. Is there a way to get a list of option labels that have been assigned to entries in a specific section? {% for ...
2
votes
1answer
655 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 ...
1
vote
2answers
482 views

Get label from value in radio buttons list fieldtype

Ok I know how to list radio buttons and use it to display a particular value: {% set newsType = craft.fields.getFieldbyHandle('newsType') %} {% for option in newsType.settings.options %} {% if ...
1
vote
1answer
237 views

Use-case: custom plugin or extended use of entries/categories/tags

I have to integrate a jobs feed into our website and I've been digging in the documentation, reading the core's code for a while now, and I am in a dilemma trying to figure out if in out use case I ...
1
vote
1answer
294 views

Craft model and populateModels() performance issue?

I'm getting a big performance hit on front end requests (+15 seconds) when using a model to store / use data from one of my custom fieldtypes, cp requests for the same data appear unaffected. The ...