Questions tagged [matrix]
Matrix fields allow you to create multiple blocks of content within a single field.
662
questions
2
votes
1
answer
49
views
How Can We Use the Native Matrix Block Copy Feature in Craft CMS 5?
It seems that Craft CMS 5 introduced a new feature allowing users to copy, clone, and paste Matrix blocks natively, eliminating the need for third-party plugins like Smith. This was hinted at in ...
0
votes
0
answers
15
views
Reorder Matrix entries programmatically
I have a few hundred entries with a Matrix field that contains blocks with a field I would like to use to order them.
Currently, my blocks are out of order. For example, it might be something like:
- ...
0
votes
0
answers
11
views
Merging multiple similar Matrix fields into one
I recently inherited a client’s Craft CMS project where the original developer has created a lot of redundancies, unnecessarily duplicating sections and doing almost identical Matrix fields for each ...
0
votes
0
answers
19
views
Craft 5.4 // Replace Neo with Matrix // any experiences?
I'm still on Craft 4.x and a Neo heavy user.
First off, Neo is a brilliant plugin – many thanks to Spicy Web!
But I still think about replacing Neo with the new features of Craft 5.x (such as the ...
1
vote
1
answer
23
views
FeedMe: glitches with importing assets into an assets field in a Matrix block (multisite instance)
I am an experienced user of FeedMe but I cannot get it to recognise an array of asset filenames in a Matrix block:
The FeedMe config sees my JSON node for the assets, and allows me to save it into ...
0
votes
0
answers
22
views
5.x - Matrix Frontend Form Submissions
Has anyone found a way to create matrix field submissions with a frontend form?
The docs for 5.x mention this section hasn't been updated and that the functionality has changed drastically.
Craft 5.x -...
1
vote
1
answer
59
views
relatedTo craft 5 nested matrix entires
Im trying to query a list of matrix entries that have a related field but it doesn't work after updating to craft 5. Note that 'category' is not category field type, its a regular structured entry ...
1
vote
1
answer
28
views
Group matrix blocks by date
I'm trying to group events in a matrix field by day. Each date has a title and start and end time. I would like events for today, tomorrow and any dates beyond grouped separately.
This is what I have ...
0
votes
0
answers
50
views
Filter GraphQL Response Based on Matrix Entry Type
In Craft 5, we now have a few Entry types with Matrix fields that can nest several other Entry types, or none. I'm struggling to work out a way to limit the returned results based on the content of ...
1
vote
1
answer
43
views
How to get all Matrix block fields in a templated table of all fields
I want to produce a templated table of all fields, including Matrix block fields which belong to their parent Matrix field.
I've been scratching around the Craft 4 class reference and getting nowhere. ...
1
vote
1
answer
114
views
Craft 5 Matrix Field have URL?
I have a staff Structure Section with the intro page (Level 1) and individual staff members at (Level 2) as each staff member has their own page /staff/joe-bloggs.
I was wondering if it's possible to ...
0
votes
0
answers
11
views
How can I list all entries that have a populated Freeform Form field?
The Freeform Form field can either be a direct custom field of the entry, or it may be inside a Matrix field's blocks or be a Super Table field.
Ideally, I'd like to do this performantly, and either ...
0
votes
0
answers
15
views
Order Matrix Block in Control Panel by Date Field
Is it possible for the individual entries within a matrix field in the Control Panel to appear in the order of a date field?
I have found here information on how the entries are sorted after saving ...
1
vote
1
answer
33
views
Matrix: Show Date Field in Card View
I would like to know if it is possible to display a custom date field in the card view of matrix field.
Unfortunately, it is not possible to use a date field as a title or part of a title. it gives:
...
2
votes
1
answer
87
views
Craft CMS 5: Can I query entries and matrix-fields together?
If matrix fields become entries in Craft 5, is the following scenario possible, robust and efficient?
Channel "speakers"
Channel "solo events":
with an entryfield for selecting ...
2
votes
1
answer
32
views
Select existing entries for a matrix-type field rather than creating new ones per entry
I have created different pages as entries. On each page I show a list of benefits of my company which are generally the same for each page but I would like to be able to customize the benefits for ...
16
votes
2
answers
5k
views
How to save Matrix data programmatically in Craft 3
How can you programmatically save an entry that has a Matrix field in Craft 3?
(Something like this gist for Craft 2)
1
vote
1
answer
30
views
Replace the value of a table cell (inside a Matrix field)
I have a Matrix field, and blocks have a Table field inside of them, with two columns: event and category.
I want to now set anything with category 'A' to category 'B' via a module (listening to Entry:...
1
vote
3
answers
1k
views
Find entries that use a specific block in their Matrix field?
Suppose a Mtrix field named MyMatrixField has three blocks called Text, Images, and Buttons.
What MySQL query would list the section and title for all entries whose MyMatrixField field has a Buttons ...
1
vote
1
answer
56
views
Create section 'landing page' with 'two column block'
I'm very new to Craft 4.
I have a matrix 'Landing Page Blocks'
I've created 2 Block Types: Hero Block and Two Column Block
Within the 2 column Block I need a left and right content block
Within the ...
0
votes
0
answers
58
views
Changing Matrix Field Propagation Settings
I built a Craft multisite a few years ago. Most of the site pages feature a content builder matrix field with multiple blocks. Many sections are shared across sites.
When I built the site, it seemed ...
1
vote
1
answer
32
views
I want to pull content from a field on an entry into a matrix block that is displayed on that entry, is this possible?
I want to pull content from a field on an entry into a matrix block that is displayed on that entry.
I have entries that are shared between multiple sites. I'd like to be able to add a field on these ...
1
vote
1
answer
57
views
Output matrix field content into a RSS feed
I'm trying to create RSS feed for a site news section, most of it is straight forward to do but I run into an issue with the description section. That content is a sub field in a matrix field along ...
1
vote
1
answer
30
views
Entry form replacing rather than appending data to a matrix field
I have this in my entry form:
{{ csrfInput() }}
{{ actionInput('entries/save-entry') }}
{{ hiddenInput('entryId', entry.id) }}
{{ hiddenInput('fields[questions][...
5
votes
1
answer
2k
views
How to check if matrix block type is empty or not
I have a matrix field with two different block types and I want create a conditional to check if one of the blocks is not empty show it and if it is show the other. This is not working:
{% for block ...
1
vote
1
answer
66
views
craft.matrixBlocks - related to entry
I've got classes by entry and each week is a matrix block inside that week. I'm then outputting all weeks together using this query
{% set startDate = date(now)|atom %}
{% set classes = craft....
1
vote
1
answer
38
views
Can not-related block types share a matrix field
I am aware that block types that are related should have a matrix shared. For example, to implement a slider, there should be image and caption block types inside a slider matrix.
But what about ...
1
vote
2
answers
718
views
Building an accordion with a Matrix field
I'm trying to build an accordion in my matrix field (that also holds entries for a slideshow, button, image, etc).
Im having trouble with getting each entry to go inside < div id="accordion">< /...
1
vote
1
answer
40
views
Events with sub-events in a matrix field - display as a calendar (combined with other events)
I'm building a site where the client has courses that run once a week. We'll have several courses and each course will have a matrix with multiple blocks detailing that weeks class.
What I want to do ...
1
vote
1
answer
39
views
Matrix Field - Call block that matches block field value
I've got an event entry with each day of the event in a matrix field block. The block has a date field eventDate and I've got it set up so each block has a unique page that display with the date in ...
2
votes
1
answer
154
views
Resaving Matrix Blocks skips because of "not loading its content"
We recently updated one of our biggest projects to Craft 4. And today I tried to resave all the matrix block with resave/matrix-blocks but was greeted with the following behaviour:
Does anybody have ...
1
vote
1
answer
69
views
Deleting matrix block on front end form
The below code doesn't appear to be working for me, it will delete all other blocks apart from itself. I just need it to delete itself.
trophyOrders is the Matrix field in the user account.
{% set ...
1
vote
1
answer
92
views
Update user matrix field dropdown through module
Appreciate I may be asking for a lot here - I have an existing module that I use to fire events when a stripe order is completed.
I would like to iterate through some User matrix blocks and update a ...
2
votes
1
answer
259
views
Generate a unique ID for each instance of a block from matrix field
I have a question regarding Matrix fields.
I have a matrix field where one block will be used multiple times (around 4 or so) on each page. When that block scrolls into view I am firing a javascript ...
1
vote
1
answer
38
views
Retrieve tags used in matrix field
I have a matrix field that includes a tags field. The matrix includes a list of events, with each event using the tag field to determine topics. I'd like to output a list of each tag used, so I can ...
1
vote
1
answer
61
views
Filtering entries via a table field inside a Matrix Block
James helped me with part one and it's working well: Filtering entries via a dropdown inside a Matrix Block
Now I would also like to filter by a table field as well. The table is extras and the ...
1
vote
1
answer
69
views
Filtering entries via a dropdown inside a Matrix Block
I have Entries with a Matrix field called events. I have an Entries field and a Dropdown field inside those Matrix blocks (block type event). I'm currently filtering by entry using andRelatedTo(['and',...
0
votes
1
answer
358
views
Import CSV data using FeedMe plugin into entries with Matrix fields
I would like to import a CSV file into but the entries contain Matrix fields. When I set up the file, FeedMe provides a way to map columns in the CSV file to specific Matrix fields but I can't find a ...
2
votes
3
answers
590
views
How to Show the Total Word Count of an Entry?
Any way to show the total word count in real-time to authors while they are writing an entry that has multiple blocks?
I don't need per-block word count ... I need total word count shown in real-...
1
vote
1
answer
169
views
FeedMe import to update specific Matrix blocks without affecting others
I'm familiar with using FeedMe to import into Matrix blocks, but I’m not sure how to do the following:
I have a series of existing entries, each with a series of existing Matrix blocks of several ...
1
vote
1
answer
160
views
Eager loading results in more queries
From what I understand it is wise to always eager load assets, I used it successfully in other cases, but here it results in a more queries, not fewer.
I am trying to eager load an asset in a matrix ...
1
vote
2
answers
509
views
Show all entries from an entry field
I have an Entry field (page) as part of my Matrix field (footer).
When the client selects 5 entries, I want to display them all in my list and not just the first. I can only seem to get my code ...
1
vote
1
answer
44
views
Finding next and previous entry within multiple matrix fields
First of all I have looked through various similar questions/answers, but don't think any of them address my specific problem.
I am building a website for an artist, and I have a Category which I've ...
0
votes
1
answer
55
views
Deleting a matrix block type that was copied in code
I'm somewhat new to Craft, and struggling a bit with copying matrix block types. Any help would be greatly appreciated.
So, I have some code that copies a matrix block and its fields, but when I go to ...
2
votes
1
answer
163
views
Updating specific field in from block in matrix field via migration
I'm trying to update a specific field (a dropdown) in an existing block (of type 'subhoofding') in an existing matrix field 'contentBuilder'
The migration itself runs fine, show the new value as ...
1
vote
1
answer
49
views
Reordering Matrix blocks by date in the control panel when saving an entry
I'm trying to reorder Matrix Blocks in date order when saving an entry in the control panel. I kind of have it working using the following code.
My Matrix field is 'events'. Each block contains a date ...
4
votes
1
answer
881
views
Is it possible to find what Matrix Block aren't being used
I have a fairly large site with the main content on most pages driven by a Matrix field. That Matrix field has 15 or so different Blocks - we are now doing a tidy up on the site and going to try and ...
1
vote
1
answer
178
views
Saving data in a table field in a matrix field via entry form
I have an entry form with both table fields and matrix fields containing table fields. I can save data into the table fields OK with fields[fieldHandle][X][colX] but with the below, I get a matrix ...
2
votes
3
answers
722
views
How to delete Matrix fields in front end
I created a user profile page with Matrix field with assets, I found this thread and this thread about adding and updating Matrix field in the frontend. Does anyone know how to delete the Matrix field?...
0
votes
1
answer
42
views
PDO Exception when accessing a matrix field
This is a really strange issue - everything had been working fine for many months then all of a sudden three specific entries in the same section started throwing PDO Exception (see screenshot below). ...