Questions tagged [matrix]

Matrix fields allow you to create multiple blocks of content within a single field.

Filter by
Sorted by
Tagged with
2
votes
1answer
36 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
1answer
22 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
0answers
25 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
2answers
36 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
0answers
13 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
1answer
28 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
1answer
28 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
0answers
17 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
1answer
51 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
0answers
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
1answer
50 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
0answers
19 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
2answers
39 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
0answers
19 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
0answers
35 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
1answer
37 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
1answer
91 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
1answer
24 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
1answer
50 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
1answer
35 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 ...
0
votes
0answers
22 views

Admin Panel For Page Only Shows Disabled Matrix Blocks

I'm a Craft novice trying to help some people who have taken over a Craft 3 website. There is a Single Page where the Main Content is a series of Matrix blocks. The problem is the admin Control Panel ...
1
vote
1answer
67 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
1answer
71 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
1answer
37 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
1answer
59 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
0answers
19 views

Auto collapse craft commerce variant matrix

Is there a way to auto collapse Craft Commerce Variant Matrix Blocks? I work with many variants per product and it is very cluttered when expanded. I've already tried this way: Possible have matrix ...
0
votes
0answers
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
1answer
24 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
0answers
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
1answer
84 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 ...
0
votes
0answers
38 views

Output Entry with Super Table, Matrix, Table for Element API

I'm trying to output a table within a matrix of a SuperTable for element API. I fail to output $projectList, I keep getting the error 'Invalid argument supplied for foreach()' or 'Trying to get ...
1
vote
2answers
71 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
1answer
293 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
1answer
39 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
1answer
62 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
0answers
19 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
2answers
34 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
1answer
249 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
1answer
49 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
1answer
34 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
1answer
23 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
1answer
196 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
1answer
124 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
1answer
20 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
0answers
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
1answer
73 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) { $...
1
vote
1answer
89 views

Asset volumes with dynamic subfolder

I have an asset volume which uses dynamic subfolders on the field level. I have an assets volume called 'members'. In a matrix field on the user profile tab there is an image field that sets its ...
2
votes
1answer
55 views

Filtering a Matrix block for future dates

I'm struggling with filtering future dates in a Matrix block that contains a date field. I would like to display 'Open' or 'Closed' as the result of a condition checking if the value of matrix rows ...
1
vote
1answer
34 views

Existing contents get deleted on Live Preview when adding new content on a matrix field

When I add a new content for a matrix block field on an existing entry, all its previous contents gets deleted from the Live Preview, except for the editor which still has the previous contents. And ...
1
vote
1answer
72 views

Order matrix blocks by date field

I'm using a matrix inside a Super Table to organize events, and I'd like to order the events using the date field for each event. I'm currently showing the first five events using limit then using ...

1
2 3 4 5
13