Questions tagged [matrix]
Matrix fields allow you to create multiple blocks of content within a single field.
619
questions
1
vote
0
answers
25
views
How do you access the Label of a Table field column with a Type of Dropdown?
How do you access the Label of a Table field column with a Type of Dropdown?
I have a Table field in a Matrix block and one of the column types is a Dropdown. When I use the {{ row.handle }} syntax ...
1
vote
1
answer
21
views
Matrix content disappears in Live Preview when updated
I'm having an issue where, if I edit any matrix content in Live Preview, all matrix content disappears.
When I first open preview, any existing matrix content will display properly, but as soon as I ...
0
votes
0
answers
12
views
Fields are saved, but not loaded for some blocks
I'm experiencing an issue on my development-environment, and I cannot figure out what's going on.
It seems that the fields of some of our blocks aren't being retrieved after saving.
To reproduce I ...
1
vote
1
answer
89
views
Creating an entry with a matrix field using GraphQL
I am trying to create a new entry in Craft CMS using GraphQL. The entry has a matrix field called "vehicles" that has a single block called "vehicle". This block has a single field ...
1
vote
1
answer
27
views
Asset Custom Field Returning Null in Array
I am relatively new to Craft CMS and I have encountered an issue that I have attempted to debug for quite some time.
When using the {% dd %} function to dump my array, a load of my custom fields ...
0
votes
0
answers
23
views
Sort Entry Array by date in Matrix Block
Goal
I am listing theater plays. Each play has multiple show dates and corresponding places for each date. Each date & place combination is recorded in a matrix block (matrix field handle: shows), ...
2
votes
2
answers
100
views
Matrix vs Neo, what should you use for 60+ multi site
Simple question: Which field type is more performant, Matrix or Neo?
I have to build a 60+ multi-site with different languages and I need to think about this architecture before building the pageParts....
3
votes
1
answer
51
views
How can I query entries related to another section’s entries having specific Matrix checkbox field values?
Let’s say I have a site with two sections: Things and Colors.
Things has a Matrix field (thingsBlocks) with a Sizes block type. That Sizes block type has a checkboxes field (sizes) with values that ...
1
vote
1
answer
29
views
Access Asset Type for subfolder
I want to create asset subfolders by page & by asset type.
I use an asset field in an matrix field for multiple asset types like video, images etc.
In an asset field I can access the slug of an entry ...
0
votes
0
answers
29
views
Eager load only ids() for related entries?
I'm hoping to slim down this query, as it doesn't scale how I need it to (having potentially hundreds of thousands of Matrix Blocks).
{% set redeemedOffers = craft.matrixBlocks()
.typeId([5])
...
1
vote
2
answers
47
views
Cumulative Addition of Matrix field elements with Feed Me
Is it possible to add blocks to a Matrix field in an Entry using Feed Me without overwriting existing blocks? I know how to add multiple blocks at once with a single JSON file, but I won't have things ...
0
votes
0
answers
15
views
Images get stuck as temporary when uploaded to an Asset Field in a Matrix Block where the storage path contains the block ID
I'm facing an issue, and possibly a bug or an un-fixable kind of logical issue, where I have a Matrix Block with an Assets Field inside of it.
The storage path for the Assets field is pointing to a ...
1
vote
1
answer
40
views
Matrix query fails when using multiple fields
I am on Craft3.5 and trying to build a matrix block query where I would like to return results from two different matrix blocks. The docs seem to suggest that this is possible.
This is the code I ...
1
vote
1
answer
42
views
craft.matrixBlocks() by section
Trying to grab the total count of matrix blocks that belong to a section. Looks like there is no section parameter for craft.matrixBlocks(). Not sure as to why that is.
Anyone know of another way that ...
0
votes
0
answers
23
views
Matrix block "default asset location" unexpected behaviour
I have a matrix block containing an image field. The "default asset location" is configured with projects/{owner.slug}. I expect this to result in the asset being placed in something like ...
1
vote
1
answer
72
views
Can't get a simple Reverse Relations for Entries field to work
I'm trying to get a simple Reverse Entries working, nothing fancy, but I'm stumped.
I created a little personal project just to help me stretch and learn Craft better. I picked the NFL Draft just ...
0
votes
0
answers
17
views
Problems with saving mutliple matrix blocks with Base64-encoded data on their asset fields
My problem
When saving two or more matrix blocks via a front end form, the Base64-encoded data does not upload an asset for each blocks. The first block gets the last blocks image data, while the rest ...
1
vote
1
answer
112
views
How do you delete a matrix block in module/plugin assuming you have the matrix block id and entry
I have the channel entry to which the matrix block belongs and I have the ID of the block itself. Does anybody know the correct approach for deleting the matrix block on the entry?
Context: module (...
0
votes
0
answers
22
views
Searching a Maps field inside Matrix
I have a bunch of entries, each one with a Matrix field, consisting of a "Location" block type, with "Map" field (Ether Maps). I need to output some JSON, following a keyword ...
1
vote
2
answers
58
views
New Matrix blocks aren't saving via front-end entry form
I have an entry type with simple Matrix field which has just one block type [activity] and several other non-matrix fields.
My front-end entry form works perfectly on non-matrix fields, but for some ...
0
votes
0
answers
20
views
Vanishing Matrix Blocks …
Odd issue cropped up on an older (3.5.19) project where client was disabling entries whilst editing and then when enabling the entry (via the Entries > Set Status in CP) any content matrix blocks ...
0
votes
0
answers
44
views
How to import Category subfields within a Matrix block using FeedMe?
I'm importing Entries that have a Category field inside a Matrix block. My JSON includes data that I want to import directly to the Category subfields.
Here's a simplified example of my JSON:
{
&...
1
vote
1
answer
39
views
block.type.handle Content Builder Matrix loop
I am attempting to make use of the method listed here
https://nystudio107.com/blog/creating-a-content-builder-in-craft-cms
twig template:
{% extends '_layouts/base.twig' %}
{% block sectionHeader %}
...
3
votes
1
answer
99
views
Efficient way to get all related entries assigned to matrix fields across a set of entries
I have a scenario where level 1 structure entries each have several to tens of level 2 child entries, and several to tens of entries in a different channel which are also allowed to be related to the ...
1
vote
1
answer
26
views
Why does the matrix field produce such a massive amount of duplicate information?
The matrix field in Craft CMS is producing massive quantities of duplicate data. About 70 database rows per entry. Is there something I'm doing wrong? I don't think this will be sustainable for my ...
1
vote
1
answer
61
views
Populating Matrix Blocks with JavaScript
I need to populate a matrix block field with JavaScript in the control panel. I've got the data ready, but i can't figure out how to add it.
I've located a function called addBlock() in MatrixInput.js ...
1
vote
1
answer
53
views
Output Channel entries on another page with a matrix block
I know im doing something small wrong but I cant see what at this point.
I have a channel called 'testimonialEntries' and I want to randomly output one of these entries on seperate pages. I cant ...
1
vote
1
answer
69
views
Display something in the middle of post content
My entry content is displayed like this:
{% for block in entry.postContent.all() %}
<div class="my-4">
{% if block.type == 'text' %}
{{ block.text }}
{% elseif ...
1
vote
1
answer
77
views
Show matrix fields based on quantity [Sprig]
I'm using Commerce to sell tickets to an event and need to get the names of each person. I would like to do this via a Matrix field, showing fields based on the quantity selected.
I followed along ...
1
vote
1
answer
44
views
Autogenerated PDF Thumbnail using PDFThumb in a Matrix Field
I would like to autogenerate a thumbnail of PDF's, and from this question I found the plugin PDFThumb. The problem I'm running into is I'm relatively new to Craft, and I can't seem to figure out how ...
1
vote
1
answer
66
views
How to search for Entries that have a particular Category set within a Matrix field in the Control Panel?
I have an arrangement like this:
Entry type 'people'
└ Matrix field 'offices'
└ Block type 'office'
└ Category field 'building'
On the Entries screen, how can I search for people that have a ...
0
votes
0
answers
36
views
Why aren't my images displayed on the homepage
Our homepage.twig is a section
Our Matrix is called "angebote" (it's german don't ask :D)
We created two entries for our matrix
This is our Code inside the homepage.twig file for including ...
1
vote
1
answer
26
views
Display field content inside a matrix from a different locale
I am building a site with 2 different languages - English and Chinese. Is it possible to retrieve only one field inside a matrix in English while I am in Chinese site? But the rest of the matrix ...
0
votes
0
answers
30
views
Hiding enclosing div if all matrix block fields are empty (although they do exist because of another language)
I have an entry with matrix fields. If I add blocks in the main language, but its fields only contain data in one language, the block query (the for loop) still finds these empty fields since they do ...
1
vote
1
answer
155
views
How to get values into twig template for fields of type Matrix in Craft CMS 2?
CMS: Craft CMS 2
In my admin panel I have globals set called X (under "Globals" from the sidebar and defined in craft_globalsets in the db from Global->Settings->New global set).
A ...
1
vote
2
answers
73
views
Getting blocks from matrix and injecting them throughout a page, NOT a single loop statement
I have a matrix field that allows the user to add little 'designed' features throughout the page.
These are placed in certain positions on the page and so I want to loop through these but because they ...
1
vote
1
answer
459
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
1
vote
1
answer
50
views
Pull Matrix Block from Multiple Entries without Showing Duplicates
I have a set of entries I am pulling ID. (group)
Each of those entries has a Matrix Block. (people)
That Matrix Block Type (person) has an entries field.
In some cases the same entry (person) is ...
1
vote
1
answer
70
views
Set fields from two different Matrix blocks, merge them and then set the output in a pretty way
Newbie here, still grappling with basics, let alone elegance. My aim is to pull content from four different fields held in two different Matrix blocks and pass the output in a nice human readable ...
0
votes
0
answers
21
views
Store Hours field in Matrix
I'm using the Store Hours plugin inside of a Matrix field along with a text input field. The global is called specialHours and the matrix has the same name.
I access the text input like this which ...
1
vote
2
answers
37
views
Matrix fields don't load!
I have some matrix fields defined:
But when I use the matrix blocks inside of an entry - I don't get all blocks - just the richText ones.
I tested it out - just the richtText Matrix blocks will be ...
1
vote
1
answer
362
views
Change matrixblock field value before save element
So i have a Matrix with one type of matrixblocks.
These all have a field for a custom id which should be set by the system, if empty, before the entry is saved.
I can access the individual ...
1
vote
1
answer
69
views
Output of matrix field twice in one template
I have a matrix field with with multiple types. In a template I want to loop through all of the entries of that matrix field as you normally would. However, I also want to access a bit of data from a ...
1
vote
1
answer
46
views
Problem with SUM on Matrix blocks
I have some Matrix blocks where I need to sum one of the fields within, but I only want to sum it when another field within that block is or is not empty.
{% set reimbursementAmount = craft....
1
vote
1
answer
29
views
Using Preparse field to display matrix blocks in Control Panel, limitations?
I can successfully use the Preparse field type to display matrix fields in the control panel, however, the output is very limited. Even my tag is stripped out.
Is there any way to do this short of ...
1
vote
1
answer
296
views
adding a block of matrix field from a front end entry form
I am trying to add a form to the frontend in which a registered user will be able to create and publish new block in a matrix field. I have read the documentation about it but am still failing ...
1
vote
1
answer
161
views
Comparing matrix blocks by type and field value
I’m trying to do something, the answer to which should be as simple as searching a Matrix field value but that’s not working for reasons I can’t fathom.
Setup
I have a Matrix field called programme.
...
1
vote
1
answer
27
views
Using a Matrix field to create a homepage that shows entries from sections and categories
I have set up 3 channel types - A, B & C and a Category. Each entry type shares the same pool of categories.
On the home page, I have created a Matrix field (homeSections) with a block type ...
1
vote
0
answers
28
views
Querying entries that have not been related to any other entry or contained matrix element
I have a large amount of content that we are attempting to collect before we migrate to our new site structures. Normally the staff are supposed to relate content back to main entries to make sure ...
1
vote
1
answer
89
views
How to reset matrix field to have NO blocks in plugin?
I want to reset a matrix field to have no blocks in it. In a plugin, I would normally set a matrix field by doing something like this:
$blocks = [];
$i = 1;
foreach ($itemsArray as $item) {
$...