Questions tagged [fieldtypes]
The fieldtypes tag has no usage guidance.
120
questions
1
vote
1
answer
96
views
How to calculate with money fields? Like extracting discount percentage
Maybe I'm overlooking something, but can't find a solution on the interwebs..
I have 2 (money) fields: product.price and product.oldPrice
When I try to calculate the discount like this (I'm aware that ...
1
vote
1
answer
149
views
changedFieldIndicator change on every commit
When we're making changes to the Craft config, changedFieldIndicator is often the culprit of many changes, and makes pull requests "larger" or more complicated than they need to be.
Is this ...
1
vote
1
answer
181
views
How do I generate a slug based on another field?
Is it possible to somehow generate a SLUG not from the title field, but, for example, from your own created field?
Example: A website for analyzing complex mathematical solutions. Each entry in the ...
1
vote
1
answer
151
views
Working with "money" values
It's the first time I have been using a "money" field and don't really know how to use it. The docs don't tell much about it so I ask for help here.
To get the value including a currency ...
0
votes
0
answers
22
views
Register own FieldType in Craft 3.x
I have the following struggle. I tried to register my FieldType in my init function of the module.php.
Event::on(
Fields::class,
Fields::EVENT_REGISTER_FIELD_TYPES,
function(...
1
vote
1
answer
330
views
Field dropdown - default value is not working in CMS
maybe this is a weird question but I have a dropdown field with values from 1 to 10, and set 4 as a default value.
The thing is: I edit my entry and when I see my dropdown the value is number 1, but I ...
1
vote
1
answer
140
views
Special characters like ✓ are not being saved in text fields
we have just noticed that characters like ✓ are being saved in the title field but not in plain text fields regardless of the database type (PostgreSQL / MySQL) or field type in the database (text, ...
1
vote
1
answer
163
views
How to Auto-generate a Title based on a multiple entries titles? (using a Entries field type)
I have two sections (both Channel type):
Releases
Movies
Releases have one Entries field type, the source is Movies
So, I want Auto-generate a Release title from Movies, like this: Titanic, Avatar, ...
2
votes
1
answer
961
views
What's the difference between Neo and Matrix fields?
Im a bit new in Craft CMS
But so far to me, seems like both allow the user to create multiple blocks of content
0
votes
0
answers
140
views
Updating Search Indexes failing because of "rouge" invalid field handle
I'm on the latest build 3.5.3. I created a Lightswitch field type within a Matrix field in my local dev env and called it "colorBlock". No problems there. When I recreated this in my staging ...
2
votes
1
answer
109
views
"Field Limit is too big for your chosen Column Type" error on already existing fields when updating matrix
I'm getting the following error when I'm trying to update a matrix:
"Field Limit is too big for your chosen Column Type.""
I'm trying to add a new block type but this error keeps getting up on ...
1
vote
1
answer
101
views
How to loop through a table and set variables based on the existence (or not) of data in those tables?
I am using a table field in Craft (price) limited to one row only, used to manage price setting in different currencies on an entry. The three cols each contain number fields with the handles dkk, ...
0
votes
1
answer
15
views
Is it possible for an assigned entry (via field type Entries field) to know what it has been assigned to?
I have two entry types 'pipeline' (structure) and 'series' (channel). I know I can add children in a structure, but I want to keep 'pipeline' and 'series' separate to avoid duplication, as a series ...
1
vote
1
answer
140
views
What will happen if we change the field type in the fields (settings -> fields) in Craft 3?
I am a beginner in Craft CMS. I just want to know, what will happen if we change the field type in the fields (settings -> fields) in Craft 3?
1
vote
2
answers
717
views
Proper way to implement array of objects as Craft field
I'm using Craft CMS for the first time and have a question about the proper/best practice to store what would equate to an array of objects (or just a plain array) in Javascript or JSON.
Say I'd like ...
1
vote
1
answer
106
views
Number field when empty and value=0
Is there a way to differentiate the number field value empty and 0?
I would like to display this field only when there's a value in the field even though the value is 0.
But when I input 0 into ...
1
vote
0
answers
61
views
Craft Table/Tabular static entry input field
Is there a way to set up a Craft CMS entry field to have a table with predefined rows and columns?
I have tried with the native Craft Table field, but it allows users to add rows or edit default ...
1
vote
1
answer
169
views
Craft CMS 3 Date Field problem
I added some date fields on my entry. I select a date and save the entry.
But the date field saved the day before.
Every editing the entry continue saving the day before. When the date comes to the ...
1
vote
1
answer
97
views
Pulling blog entries related to a structure entry field type
fairly new to craftCMS. I've wrestled with this now for hours and exhausted all research avenues.
I have three main "service pages" (Web Design, Digital Marketing, Hosting & Analytics) These are ...
1
vote
0
answers
28
views
Storing complex field content (plugin)
I'm trying to work through some issues with the field content for our Maps plugin, but I'm not sure about the best way to go about it.
Currently the value for each map field is stored as an element ...
1
vote
1
answer
256
views
Loop through all created fields and get the field type
I want to show some input fields on frontend template form.
Type of input is dependent on the type of fields selected on the backend.
For example, if the text field is selected in the backend I ...
1
vote
1
answer
29
views
Values from fields in templates
I have categories in my cms.
How do I gets a list of these value into my templates?
Thanks.
2
votes
1
answer
178
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
1
answer
218
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
1
answer
33
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
1
answer
86
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
2
answers
781
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
1
answer
1k
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 ...
1
vote
1
answer
252
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
1
answer
353
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, ...
2
votes
1
answer
2k
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
1
answer
49
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
1
answer
116
views
warning icon on fields
I am seeing warning icons on drop down fields like this
Where does this come from?
1
vote
2
answers
2k
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
0
answers
51
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
1
answer
356
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
1
answer
686
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.
2
votes
1
answer
152
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
1
answer
93
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
0
answers
91
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....
2
votes
1
answer
686
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 ...
6
votes
1
answer
344
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
1
answer
56
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
1
answer
911
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
1
answer
414
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="...
2
votes
1
answer
470
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
0
answers
90
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
1
answer
49
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
1
answer
190
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
1
answer
117
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 ...