Questions tagged [entries-field]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6
votes
4answers
3k views

Programmatically update entry field

I'm trying to update an entry's field value from a Craft plugin. First I was trying to just update the attributes of the entry like so: $entry->getContent()->setAttributes(array( 'metaStatus' ...
6
votes
1answer
1k views

How do I use a Dropdown 'Entries' Field Type in a Front End Form

I have an Entries field that I need to have as a drop-down field in my front-end form. The code below is displaying the correct options, although after selecting and submitting the form, the ...
5
votes
1answer
217 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
5k views

How to output an Entries Field value within a Matrix Field block

I'm trying to code up a Matrix field for a homepage slider, and it contains a single 'Slide' block type. It has fields for Image (Assets), Heading (Plain Text), Sub-Heading (Plain Text), and Slide ...
4
votes
2answers
2k views

Exclude “featured” entries from a “recent” entries {% for %} loop

Here's my current setup: Blog (Channel) - All of my blog posts will go here Blog Landing (Single) - This section only has one field - a Featured Articles Entries field that lets me select 3 entries ...
4
votes
2answers
843 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
1answer
379 views

Many db requests with relationship fields

I have a page with a lot of entries fields. They are awesome but that leads also to a LOT of db requests. Aside from caching are there some best practices to lower db requests on entries fields? For ...
4
votes
1answer
904 views

What's the best way to paginate through entries from an entries field type?

I have an entries field type associated with a structure section page. This displays the entries on this page in a particular order. When you click an entry link ti will take you to a detailed page ...
3
votes
1answer
2k views

How could I have a plugin hook into when I edit or update a post?

What I am trying to do is have my plugin know when I edit a post that is part of a particular section - let's call it "parts" - which then checks to see if a field is filled out in the form and then ...
3
votes
1answer
230 views

Set Entries field in Commerce order on completion

I'm trying to set an Entries field within a Commerce Order once the order completes. I've tried using the onOrderComplete event like so; craft()->on('commerce_orders.onOrderComplete',function($...
3
votes
1answer
1k views

Get related entries from matrix field

I have a matrix field with one block type. In that block type, I have one field that is a related entries field. How do I access the title from the related entries field from the matrix field? Here ...
3
votes
1answer
537 views

Hide (or disable) an entry field in CP depending on user group permission?

So I am trying to hide (or disable) a field in the "Edit Entry" view in the CP. I know how to test a user group : {% if currentUser.isInGroup('groupHandle') %} But I cannot find a hook in Craft ...
3
votes
1answer
311 views

Related Entries not sorting correctly

Craft 3.0.16.1 I have a relationship that is outputting entries, but the entries are not in the order as selected. {# not sorting correctly - **fieldName** is a variable passed via include #} {% ...
3
votes
1answer
122 views

Why if I change ie. drop down value, all entries needs to be resaved to take changes? How can I prevent it?

And why clearing cache is not enough?
3
votes
1answer
268 views

If loop contains id `X`

Is it possible to check a matrix array for an ID? I created a entries field which functions as a navigation. Now if the user decides to remove one entry I want the specific template to return a 404 ...
3
votes
3answers
1k views

Multiple craft.entries field parameters

I have an for entry loop in which I need to look for two different field conditions. Separately they are: craft.entries.eventStartDate('>=' ~ (now.date)) craft.entries.genericEventDate(':notempty:...
3
votes
1answer
699 views

Get matrix entries related to an image asset via specific field

I have a Matrix field that has an Entries field. I want to get those entries, in the selected order, removing entries that don’t have an image asset assigned to the pageImage field. Attempt 1 Gets ...
3
votes
1answer
294 views

Relating entries to assets within an ElementAction

I'm following the Element Actions example from the official Craft docs. I've defined an Artist entry type, and have defined an entries field on my Assets to relate an Artist to each Asset. To avoid ...
3
votes
1answer
137 views

How can I select channel index/root pages from an Entries Field Type?

This seems like a somewhat overlooked feature. When I use an "Entries" field type with "All" sources selected. I don't have the option to select the root link for any of the channels. I can select the ...
3
votes
1answer
1k views

How can I programmatically set the value of an Entries field type?

I need to set programmatically the value of an Entries field type when I'm going to create a new entry from the admin form, after the form loads I'm searching for the entry I need to set in the ...
3
votes
1answer
183 views

Multiple Entries fields, show empty ones?

I am using Entries Field to display related content. I have several Entries Field in an article and i also want to display the fields that are empty, but with their section name.... Is this even ...
3
votes
1answer
715 views

How to filter what is showed based on radio button checked

I am fairly new to Craft CMS coming from ruby on rails and angularjs. I am running into an issue with attempting to display images on a home page based on whether or not the radio button titled "...
2
votes
1answer
116 views

Is it possible to limit the level at which entries can be selected from within an entries field?

I have an entires field which is using a structure as a source. The structure has 3 levels and I would like to be able to limit it so the user can only select entries at the second level. I've had a ...
2
votes
2answers
150 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
252 views

Outputting Matrix blocks with grouped values based on Entries field id

This is the setup: I have a Matrix field called Breads. There is 1 block called Bread. Within, I have two fields: An Entries field called Selected bread (limited to 1 entry) A Number field called ...
2
votes
1answer
2k views

Checking if a matrix field with entries has more than one entry

In my HTML-prototype I have two ways of showing a module of employees. One version shows one employee, and the other shows two. To build this in Craft I have setup a Matrix field (with a handle ...
2
votes
1answer
254 views

Use an entry field's value in body class

I have created a plain text field that is assigned to a section and is available in the tabs for entries in that section. I want to use this field's value to modify the CSS on my template. My _entry....
2
votes
1answer
177 views

How can I merge entry values to create a select dropdown

For the life of me I can't seem to find an answer for this question, so here goes! I have a field called jobCounty in a section called jobs. The jobCounty is selected in the CP from a drop down list ...
2
votes
1answer
1k views

Add, remove, and append entries to an entries field via frontend form

I'm making a one-button form, to add an entry to an entries field. Adding seems pretty straightforward, but it overwrites any previous entry that occupied the entries field. How would I append an ...
2
votes
2answers
2k views

Display entries based on 'entries fields'

I want to display blog entries within the related entry template linked together with 'entries fields': -- Entrysection Bla Blog -- Blog entry 1 (Linked to Entrysection Bla via 'entries fields') -- ...
2
votes
1answer
880 views

Passing Multiple Relation Criteria In Plugin

I have a channel (projects) that has two different entries fields (year & research theme), both of which I want to be able to search in a plugin. The docs for the relatedTo entries method show ...
2
votes
1answer
166 views

How to get all (prepped) field values from an entry, indexed by field handle

Getting field values, properly prepped, is covered here: What is getContent() / the ContentModel, and how do I use it to get and set custom field values?
2
votes
1answer
144 views

Get different kind of entries relatedTo one asset (many to one)?

I got an asset field called docs which is contained in 2 different entries. Those entries are in different sections and they contain the docs field directly or through a matrix field called ...
2
votes
2answers
270 views

Select entry from any locale with Entries Field

I'd like to be able to create an Entries field that can select from entries from all locales. Currently it looks like there's the option to choose a single locale or specify the same locale as the ...
2
votes
1answer
21 views

Element API using the entries field to display related content from a separate section

I've seen similar questions but none seem to help. I have two sections named jobs and jobDescriptions. I'm using the entries field to pull in a description field from the jobDescriptions section to ...
2
votes
1answer
411 views

Element API Fetch Entries URL Within Matrix

I have a matrix with a field to set a Entries URL. Unfortunately the entry is not being returned, only an empty object. Here are my field settings below and element api code. See below for the ...
2
votes
1answer
172 views

Using values from one entry as default values in another?

Is it possible to do the following in Craft? I want to set up course information as follows: 1) have a courseType which contains default values for that type of course - name (i.e. 3 hour skills, ...
2
votes
1answer
149 views

Omit Featured Entry from loop of entries with additional omissions

I have a homepage single section has a field for entries (only 1 can be selected). This field is called featuredEntry. In my homepage template (index.html) I set a variable {% set featured = entry....
2
votes
1answer
33 views

I want to display entries that have a field that is the same as a field in a global variable

There is a publishMonth (multiselect) and publishYear (radio buttons) field in each article. They do not correspond to an actual date. Each article is is associated with one year, or one or more ...
2
votes
2answers
225 views

Maintaining a relationship of parent from children selected through entry field

Not sure that is the best title but: I have a Section called Research Projects. An entry from this section contains a number of images, videos and audio entries in a grid chosen through an Entry ...
2
votes
1answer
542 views

Entries Field Type Validation

I am having some issues understanding why validation is not working on my entry forms. I've got an entry with several field types which aren't of type "entries" and the required validation is working ...
2
votes
0answers
153 views

Default values of new fields for existing entries

I added a new SEOmatic field to a section that has around 500 entries. As for any other new fields that you add to a section, the default values are only applied on the entries if you open and save ...
2
votes
0answers
65 views

Return all entry types or entry fields for one entry object [duplicate]

Is there a way to pull out all entry fields for an entry by their handle so they can be looped through? For example rather than doing each field manually like {{ entry.title }}, {{ entry.description }...
1
vote
2answers
1k views

Order “Entries Fields” by entry order

I want to order entries in an "Entries field" by the order I added them to the field. So Anastasia would be first and Beni would be last. My only idea was .fixedOrder like you would do it with an ...
1
vote
1answer
180 views

Setting channel url format to include value of entries fieldtype URL

I have a channel with an entry type which has a simple dropdown for {region} and an entries fieldtype which links to a channel of destinations. I'd like the URL format for the channel to be /region/...
1
vote
1answer
384 views

Sorting Entries field results by category

I have an entries field 'physicians'. I want to output the selections from that field and sort them by category (also named 'physicians') - with the category heading above each category group. I can'...
1
vote
1answer
165 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 ...
1
vote
1answer
17 views

Output specific entry from entries field based on position

I have an entries field in a section, I am looking to output a certain selected entry from this field based on its position. For example I want to out the 2nd or 3rd entry only from this entry field, ...
1
vote
2answers
312 views

Group entries by Category and then in each category by related entry field

I have a channel with categories and an entries field. I need to first group all entries by their category. This is working fine. {% set entries = craft.entries.section('publicationsChannel') %} {% ...
1
vote
1answer
963 views

Frontend form with relation to an entry

I have a field called "assetId" from Entry "A" with Field Type "Entries" and Source "B". How can I build a form so that a relation between these two entries will be established. In the craft backend ...