Questions tagged [custom-field]

The tag has no usage guidance.

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

How to add custom user fields to the front end registration page

This question is similar to this post, but more of the next logical step. I have added custom fields to my user profiles, but would like these attributes to be part of the registration page. For ...
user avatar
9 votes
2 answers
1k views

Is it possible to output the name of a Matrix Block?

I'd like to output the Names of Matrix Blocks. I know you can filter by block types e.g. {% for block in entry.myMatrixField.type('text, heading') %} {% if block.type == "heading" %} <h3>{{ ...
user avatar
  • 1,355
7 votes
2 answers
851 views

Best way to use custom enums in my plugin templates?

I am building a plugin that's uses an enum for custom statuses. The statuses are integrated within my plugin with the exception of changing the status in my template code. pluginname/enums/...
user avatar
6 votes
1 answer
2k views

How can I update custom order fields in the frontend

I am struggling with using additional custom order fields. (Added in the Craft Commerce settings at "order fields", in the field layout manager) I try to update them like this in the checkout process:...
user avatar
  • 383
6 votes
1 answer
504 views

Display thumbnail using defineTableAttributes for a custom Element Type

Hi, I'm new to Craft and VERY new to plugin development. I'd like to display a thumbnail image in my table list view and thought it would be possible to accomplish using a new Custom Element Type. ...
user avatar
  • 121
5 votes
2 answers
596 views

How can I limit a list based on a custom date field

I a trying to display a simple event listing. I set up a custom date field called eventDate to note when the event happens. This code delivers me the list of events sorted by eventDate: {% for ...
user avatar
5 votes
1 answer
718 views

"Excerpt" option in Redactor?

I love using the excerpt option in Wygwam (CKEditor). I've looked high and low but as of yet, have been unable to find a way to have an exceprt show short of having a whole second field. I have seen a ...
user avatar
  • 1,909
5 votes
1 answer
220 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 ...
user avatar
4 votes
1 answer
110 views

Is there a way to re-use field groups/layouts?

Coming from Wordpress and using ACF plugin...it's really nice to be able to have say a field group called "SEO Fields" that contains all the custom fields for SEO needs (title, description, ...
user avatar
3 votes
2 answers
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 ...
user avatar
3 votes
3 answers
1k views

Option and notes fields after cart at checkout for order, not just line items

My client has gift wrapping services but they apply to the entire order, not one single line item. How would I add notes or custom fields to the entire order, at the shipping stage of checkout? is ...
user avatar
3 votes
1 answer
1k views

Display custom product field in cart

How would I access a custom product field in the cart. I did it with the snapshot attribute like so: {# cart.html #} {% for item in cart.lineItems %} {{ craft.commerce.products.id(item.snapshot....
user avatar
  • 481
3 votes
1 answer
429 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 ...
user avatar
3 votes
1 answer
577 views

How does a plugin make use of Craft's storage?

I am building a plugin that needs to cache generated images into a directory in Craft, presumably the craft/storage directory. I took a glance in the docs, but couldn't find much in the form of how to ...
user avatar
3 votes
2 answers
643 views

How to store custom data into a user

I need some direction in how to store (complex) data into users (best practice) I'm working on a project for a fitness app. I created a structure with 2 levels for workouts where level 1 entries are ...
user avatar
  • 160
3 votes
1 answer
582 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 ...
user avatar
  • 2,023
3 votes
1 answer
287 views

Can a model or record have conditional requirements?

I have a form that spans two pages, with a required field on both pages and an optional field on both pages: Form A - Page 1 - Question 1 (required) - Question 2 (optional) [User submits partial ...
user avatar
  • 13.3k
3 votes
1 answer
76 views

Use own/custom field inside Craft Table

I made my own, fairly simple field inside a Module for Craft 3.x. What settings do i need to define to make it usable inside a table?
user avatar
  • 369
3 votes
1 answer
32 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/...
user avatar
2 votes
2 answers
1k views

Adding Columns to a table

Is there a way or a plugin that allows you to add columns and change columns heading from within the entry? Instead of defining column heading while creating the table field. It would be nice to have ...
user avatar
  • 147
2 votes
1 answer
75 views

date in database -1 day as on frond-end

We just found out that in the database birthday field, all dates has 1-day difference than what is shown on the front-end. On the front-end, it is the correct date by the way. Question: Is it a bug ...
user avatar
2 votes
1 answer
148 views

Unable to store Model in Commerce Order Fields

I'm trying to use custom order fields in Craft Commerce to store a reference to an object, but all I am getting back is an ElementCriteria model. I have two custom order fields defined: twoDayOption ...
user avatar
2 votes
1 answer
61 views

Can I change a user field with twig without using a form?

I basically just want to set the value of a users field to a different number if something happens, so that the user field is actually updated in the CMS. Can I do that without creating a form? So ...
user avatar
2 votes
1 answer
197 views

saving user field type custom field - Failed to set unsafe attribute

I have tried to save a custom field of "user field" type which resulted in this error. "Failed to set unsafe attribute" code: $order->setAttributes(array( 'operatorUid' => Craft::$app-&...
user avatar
  • 21
2 votes
1 answer
822 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 ...
user avatar
2 votes
2 answers
513 views

Populate or change the selection options in one field based on selected option in another field in the CP

I'm looking to change a select fields options with the onChange event from another select fields chosen option. Obviously this can be done with js on the frontend as per this post but has anyone done ...
user avatar
  • 2,023
2 votes
1 answer
836 views

Entries search query by 2 custom fields

So I have a Entry type that has two custom fields on it. Both fields are integer fields. I'd like to make a query in PHP that gets the entries by two custom fields, both of which are integer values. ...
user avatar
2 votes
1 answer
264 views

How can additional custom fields be added to the Sites settings?

In Craft 3 Sites, there are some default fields like language, handle, etc. I would like to add additional fields. Is this possible. Specifically, I want to add an Image field so we can add a flag ...
user avatar
2 votes
1 answer
335 views

Get future multi-day event entries with custom date field

I have an event section with custom fields for eventDate and eventEndDate. I'm listing upcoming events in my template using: {% for event in craft.entries.section('events').eventDate('>='~now)....
user avatar
  • 960
2 votes
1 answer
1k views

Using the required field validation in custom element types/plugins?

I am finishing up the last few details on my custom element type. I have custom statuses and public submissions working. The last detail is providing validation on custom fields set through the field ...
user avatar
2 votes
1 answer
49 views

How to validate custom field duplication on Front end form

I am working on the Entry Form for a shop entry (Channel section type). For the shop entry, there is one custom field named "businessNumber" that must be unique. All shop entries in a single ...
user avatar
  • 23
2 votes
2 answers
332 views

Is it possible to populate admin form with data supplied by an external API?

I've been tasked with reviewing Craft as a potential solution for the company I work for and one of the requirements is that we need to be able to provide data from a external API in the page creating/...
user avatar
  • 21
2 votes
1 answer
835 views

Make fields conditionally required

Is there a way to make fields conditionally required? I have a toggle field that is used to hide or show a section (see screenshot: "Section 3 enabled"). If the section is shown (toggle: on), the ...
user avatar
  • 21
2 votes
1 answer
64 views

Save same Entry more than once with help of custom relations field

Is it possible to save the same Entry (red arrow) twice/more than once in one custom relations field? "Test Playlist" is a entry in a channel. Background: I have set up a playlist, where an entry ...
user avatar
  • 319
2 votes
2 answers
928 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 ...
user avatar
  • 2,023
1 vote
2 answers
247 views

Retrieve entries on custom field date using ElementCriteriaModel

I am trying to retrieve an array of entries on a particular section where inspectionDate is greater than today's date. Here is the code. $criteria = craft()->elements->getCriteria(ElementType::...
user avatar
  • 333
1 vote
1 answer
3k views

How to save a new entry with custom fields - Craft 3

I'm trying to create a new Entry via PHP, with custom fields (Craft 3). I can save it, however my custom fields don't appear. I've tried using setFieldValue, as well as $entry->excerpt = 'Lorem...';...
user avatar
1 vote
1 answer
180 views

How do I set the value of a custom entries order field from a plugin?

I'm trying to set the value of a custom field on an order when saving an entry. I found an example of how to do this for a simple text field, but the field I'm trying to set is an entries field, not ...
user avatar
  • 373
1 vote
1 answer
104 views

How to pull out all user data in a template?

I'm trying to pull out user data in a template for specified user profiles whilst the current user is logged in. To do this I check on the userId being referenced and use: {% if userId != currentUser....
user avatar
  • 2,023
1 vote
1 answer
312 views

Return entries where custom field partially contains

My entries have a field containing a third-party product id and a price, separated by a hyphen, like so: p666a-12.99 In the template, a plugin is returning me some product ids, and I want to return ...
user avatar
1 vote
1 answer
42 views

Add custom field value to Commerce Order Confirmation E-Mail

in my confirmation e-mail i output all ordered items. now i want to add a custom field (the article number) from a product, but it does not show up. i show items like this: {% for item in order....
user avatar
  • 319
1 vote
1 answer
18 views

Get field settings of custom field via ElementInterface

It is possible to get the field settings via ElementInterface in normalizeValue Method ? I need these settings of my custom field from my plugin : how i can get now these values inside normalizeValue ...
user avatar
  • 53
1 vote
1 answer
65 views

Countries Field for Freeform

The Freeform docs say there is a predefined option for Countries, but I do not see it anywhere in the Field types or existing fields. How does one access this? Using the latest version of both Craft ...
user avatar
  • 1,311
1 vote
2 answers
499 views

how to search for entries where a custom field is either not present or is empty

Some of my entries have the optional plaintext field myCustomField. I want to retrieve all entries except those where myCustomField is filled out. I can get all entries that have an empty ...
user avatar
  • 228
1 vote
1 answer
120 views

Add Checked Attribute to Custom User Fields on Frontend User Form

I have a multi-select for users to sign up for newsletters. When they edit their profile they need to be able to see which newsletters they are already signed up for. I have the code to output the ...
user avatar
1 vote
2 answers
194 views

Custom fields on a structure or section archive page

I have a section (or structure, works both) for "events". On the archive template (see image below) I want to add a custom image in the header. The administrator needs to be able to upload the header ...
user avatar
1 vote
1 answer
304 views

Custom Field on Settings page

I would like to have a custom field on the general settings page where I can enter the meta description for the website. Can this be achieved somehow? Another way I could think of is to add such a ...
user avatar
  • 433
1 vote
1 answer
75 views

Checking value of customer order field within Plugin

I am trying to check the value of a checkbox as part of my checkout process. I have the following function at the moment. public function init() { craft()->on('commerce_orders....
user avatar
  • 1,834
1 vote
1 answer
873 views

customised slugs using custom field

I have a 'Profile' channel that gives the profile of people. I have 'Last name' as the title, 'first name' and I'd like to use first name in the slug rather than have to add the first name to the ...
user avatar
  • 1,793
1 vote
1 answer
309 views

Why won't the values of an editableTableField show up in my template?

I'm still trying to process my csv data as mentioned in a former question. But I'm struggling with another part of this right now. I decided to implement a custom field type which should display the ...
user avatar