Questions tagged [field]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
17
votes
3answers
3k views

Exporting/Importing Fields

Is there an easy way for Importing/Exporting Fields? I'm just working on a selection of Global fields that I'd like to be able to add for each client site. These would be things like Contact Details, ...
13
votes
2answers
1k views

How do we create a pre-defined Asset upload field in a plugin that integrates with the native Craft Assets file manager?

We've got a plugin. It doesn't have the ability to add custom field types. We're pre-defining all of the fields. One of the fields needs to be an Asset field. A user should be able to upload an ...
11
votes
1answer
6k views

How to display all fields belonging to current entry?

How do I modify a template to include a loop that displays all custom fields that I added to the field group that the current entry belongs through? I know how to display the fields individually by ...
11
votes
2answers
444 views

Will having large numbers of Fields decrease site performance?

I know that on page load Craft makes multiple queries to get Fields. I have about 300 separate fields on a pretty large site. I know it's probably better to reuse fields when I can, but in many cases ...
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
2answers
3k views

“Conditional” field layout - hiding or showing fields based on another field

is it somehow possible to conditionally show or hide fields in the entry editor based on the value of another previously entered field? An example of this use would be: A section has Lightswitch ...
8
votes
1answer
742 views

How do I maintain the on value with a lightswitch-field as a plugin setting?

I'm trying to use a lightswitch-field in a plugin-config. But for some reason it won't get saved. The lightswitch-field is always off. protected function defineSettings() { return array( ....
8
votes
2answers
506 views

Is there any way of specifying a default category for a category field?

I've set up a channel using categories to distinguish between different blog post types. The majority will probably be in one category, so it would be great to be able to specify a default category. ...
7
votes
4answers
966 views

Matrix field alternative (or easier field grouping)

Just started working with Craft, and it's been great! One question I have is regarding the 'correct' way to create a group of fields, rather than using Matrix or Table. To better illustrate, see the ...
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
1answer
2k views

Get dropdown / checkbox / multiselect field values on frontend submit

I would like to allow registered users to submit entries to sections. The documentation didn't mention how to get the values and labels of dropdown / checkbox / multiselect fields to show them as ...
6
votes
1answer
422 views

Migrate contents between fields?

Right now, we have a matrix field called post body which has all our content, we have text, image, video etc... In our image block we have 2 fields, An asset field called image & a plain text ...
5
votes
2answers
416 views

Is there a way to populate a drop-down with the templates files in a folder?

When I have a folder setup for template partials, is there a way I could automatically populate a drop-down with the list of templates in that folder? This would be useful in the case where I have a ...
5
votes
1answer
1k views

How do I output a dropdown's values if I'm on a registration form not tied to an entry?

I have a registration form on my website. All of the fields here so far have been text, which is no problem. However, I've just been asked to create a dropdown box for users to select their salutation ...
5
votes
1answer
588 views

Can I add an enabled-by-default lightswitch field to existing entries?

I've created a lightswitch field that defaults to "On", and it works fine for new entries, but for all existing entries it is set to "Off". I'm keen to avoid having to manually go through all existing ...
5
votes
2answers
1k views

Programatically Adding Fields to a Layout

I am looking to add a field (or perhaps a group?) to the userlayout via a database migration. I've looked over the docs, and found Is it possible to add a custom field to User model from a plugin? ...
5
votes
1answer
1k views

How can I limit the rows returned in a table field?

I want to limit the rows returned here to 4, then if loop.index is 3 display a separator and then output the last row. Does the table field have that kind of control? {% for row in registration....
5
votes
2answers
1k views

Restricting access to fields based on user group

I saw this thread Check user is in User Group / Custom User Permissions had an idea. Can I use USER group to limit who can see the Author dropdown on the entries form? Is this even permitted the craft ...
5
votes
1answer
252 views

Is there a way to hide Matrix blocks based on the Selected Entry Type?

I have 2 primary entry types, one for a full width page, and one for a sidebar page. The sidebar page shares about 90% of the same block types as the full width page. The other 10% do not apply to ...
5
votes
1answer
210 views

Entry with many fields vs plugin/custom data structure

i'm just getting my feet wet with craft and would appreciate some pointers. Basically, what i would like to do is show and compare products. Each product will have a description, price, review, and ...
4
votes
2answers
1k views

How do I find the closest parent entry with an Assets field filled in?

I have a structure that goes up to 4 levels deep. Each page has a field for a 'hero' image. If a child page does not have this field filled out I would like to traverse up the structure and find the ...
4
votes
1answer
116 views

How can I test if a field has been assigned to a channel?

I've got a generic template that can display entries from different channels. How in the template can I test if a field has been has been assigned to any given channel?
4
votes
2answers
798 views

How to use a global variable in a conditional statement if an entries relation field is empty?

{% if entry.fieldHandle %} {{ entry.fieldHandle}} {% else %} {{ global.fieldHandle}} {% endif %} Doesn't seem to be rendering for me. The entry field shows up when it's true, but the global field ...
4
votes
3answers
2k views

Search for entries with matrix field's value

I'm building a travel site containing Campaigns (entries) Each of these campaigns has multiple travel dates, modelled by a matrix field of [startDate, endDate, price] I want to do the following ...
4
votes
3answers
547 views

Unchecking Rich Text option to clean up HTML still cleaning?

We've unchecked the clean HTML feature on a few rich text fields but our attempts to add some html (span tags) keep getting cleaned out. Is there another setting we should be looking for?
4
votes
1answer
206 views

Entries retain field data that has been removed from entry type layout

I have a single page section titled "About". At one point, I had assigned a "text" Rich Text field to the entry type layout. I then put some filler text in this field and saved the entry. Later I ...
4
votes
1answer
434 views

How do I select a default in the Position Select field?

Just getting around to adding advanced layout features to our site, when I say advanced I just mean floated images left & right. The problem I seem to have though is that left is always the ...
4
votes
1answer
697 views

How to programmatically add fields to matrix blocks?

I am easily able to add a Matrix. I am also easily able to add a BlockType to that matrix. → I am fine so far. But I have no clue what I am missing when I try to add fields to my blocks using ...
4
votes
1answer
571 views

How to list all existing values for a field across site

I have a huge set of entries which have a lot of fields. Say, the entry type is a 'book' and fields are 'keywords', 'year', 'authors', etc. Now I'm building a filter form which would allow user to ...
4
votes
1answer
698 views

How to use a Numeric Field with a Default Value

I have a case where I need to use a numeric field which also has a default value. For example: numericField needs to have a minimum value of 100 and a max value of 1000, but when the user adds a new ...
3
votes
2answers
1k views

Craft's Content Table

I'm essentially in the process of learning Craft and in that process have made some great strides. Today I was examining Craft's tables to see how it was actually storing fields created through ...
3
votes
1answer
210 views

How does Craft automatically wrap `fields[]` around name attributes?

When you use a form macro to generate an input in the CP, you'll end up with something like this... <input type="text" id="fields-myField" name="fields[myField]"> Oddly, it looks like "myField"...
3
votes
1answer
377 views

How is Craft able to reuse fields in different Sections? (As opposed to EE.)

I'm a HUGE fan of Craft, but I'm wondering how specifically it's able to reuse fields in different sections. I'm very accustomed to an ExpressionEngine environment, where each field's shortname has to ...
3
votes
2answers
842 views

Disable or hide an entry field in the CMS

Is there a way to hide or disable an entry field in the CMS so that the field still exists in the database but can not be edited by a user. The field will only ever be altered dynamically from a ...
3
votes
2answers
1k views

Clarification on UID creation

I have a series of matrix blocks that use a ton of the same fields and was hoping I could simply duplicate them in the database and update the context and id of the fields. It'd be a LOT faster this ...
3
votes
1answer
1k views

How to clear the database of unused fields?

I have one section with different entry types. One entry type uses two matrix fields, another one only one, and so on. Since the frontend layout is always the same, I use one template for the whole ...
3
votes
2answers
361 views

How to check if entry field value is already outputted, and prevent it again?

For an event page I have the option to filter on cities and countries. Each event has entry fields in which the city and country, of which the values are outputted in a drop down list on the front end....
3
votes
1answer
192 views

Get field that contains search query

After a standard search with something like: {% set results = craft.entries.search( query ) %} {% for result in results %} <ul> <li>{{ result.link }}</li> </ul>...
3
votes
1answer
159 views

Use Matrix field to output specific html

I am quite new to this so, please be patient. I am wanting to output the following html: <script type="text/javascript" src="js/jquery.jcarousel.min.js"></script> <script type="text/...
3
votes
1answer
382 views

Cannot select subcategory field in entity

I have a Structure section fruit with a single entry type fruit. I also have a Category fruitType with 2 levels: Citrus Orange Lemon Lime Melons Watermelon Honeydew The entry type fruit has a ...
3
votes
2answers
650 views

Creating and using custom content tables

If I want to create fields that get set to a custom content table rather than craft_content how would I do that?
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
549 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
611 views

Query for blocks across Block Types using the new field parameter?

This is a great new feature of Craft 2.3: It is now possible to set custom field parameters on Matrix block queries. I was wondering what would happen, if two or more Matrix Block Types had a ...
3
votes
2answers
1k views

Getting “Internal Server Error: Function 'dump' does not exist” when accessing/creating custom fields

On my in-development version of a site I'm working on, I'm unable to access any of my custom fields without Craft displaying an error that reads: Internal Server Error Function "dump" does not ...
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
1answer
138 views

How to print all possible options of a dropdown field inside of a Matrix field?

I'm asking this outside an entry context. My starting point is {% set field = craft.app.fields.getFieldByHandle('matrixFieldHandle') %} When I print the data of the field, I find nothing ...
3
votes
0answers
247 views

How can I create a dropdown field programmatically with a plugin?

I'm trying to create a Dropdown field and add it to the User field layout. I've successfully created an empty dropdown field (no options) and added it to the User field layout. Here is my current ...
2
votes
3answers
2k views

Custom HTML in Rich Text Fields

I've noticed the HTML option above Rich Text Fields for entries is now gone in Craft 2.5, regardless of being configured as Default, Simple, or Standard. Is this a feature that has been removed from ...
2
votes
2answers
1k views

How do you wrap text with HTML within a Plain Text field?

I have a Plain Text field used for product names. Some of these product names have a Registration Mark or a Trademark, which needs to be formatted within a superscript. Here is code within my ...

1
2 3 4 5