Questions tagged [matrix]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
14 views

Super Table Field error while editing the content

I have created a global field combined with Matrix and Super Table. Unfortunately getting error Return value of verbb\supertable\elements\SuperTableBlockElement::getContentTable() must be of the type ...
0
votes
0answers
9 views

Craft 2: edit a value in a matrix field

This should be fairly easy but I can't figure it out: $criteria = craft()->elements->getCriteria(ElementType::Entry); $criteria->section = 'news'; $entries = $criteria->first(); // a ...
1
vote
1answer
31 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
16 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 ...
0
votes
0answers
18 views

Find entries that use a specific block in their Matrix field

I am using this solution to get the latest article with a video. This works great, until I delete the Matrix block in my latest entry with video, then it still finds that entry, but without any data. ...
1
vote
2answers
26 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 ...
0
votes
1answer
35 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
22 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
20 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
12 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
28 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
52 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. ...
0
votes
0answers
30 views

How can I add data to a matrix field from a module without overwriting existing data?

I have an entry that has a matrix field. From a controller in a module I want to add additional data to it (e.g. some text that I have in a variable $messageText) but without overwriting the existing ...
0
votes
0answers
15 views

Building a tab component in a matrix content builder - child matrixes with SuperTable plugin

There are similar questions and answers, but I'm not finding any that are answering my specific questions. I've built a content builder with a matrix in Craftcms like these tutorials have gone over. ...
0
votes
0answers
16 views

Optimising entries fetching in php

First of all, the last time I did php was 10 years ago in school, so I'm basically a noob :D I have two channels, let's say shops and products. Shops contains a matrix field composed of a product ...
1
vote
1answer
13 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 ...
0
votes
0answers
26 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
28 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
30 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 ...
0
votes
0answers
35 views

Super Table fields in Matrix blocks not automatically propagating content across sites

Please bear with me as I try to explain what's going on. Feel free to ask for more details if needed. Simply put, Super Table fields in Matrix blocks are giving me trouble for multi-site. I am ...
2
votes
1answer
38 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
21 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
56 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 ...
0
votes
0answers
34 views

How to add new Matrix block to entry field in php?

$draft = new Drafts(); var_dump($entry->slug); $draftEntry = Entry::find()->slug($entry->slug)->one(); $draftEntry->typeId = 32; ...
1
vote
1answer
21 views

“Field Limit is too big for your chosen Column Type” error on already existing fields when updating matrix

I'm getting the following error when I'm trying to update a matrix: "Field Limit is too big for your chosen Column Type."" I'm trying to add a new block type but this error keeps getting up on ...
1
vote
1answer
9 views

Matrix-field with a category-field to output category-title on single entry page

Me and categories, always giving trouble :) On blogs, we are using a matrix field and in one of the matrix-types, I have a category field. This is to output the title of the category. {% extends "...
1
vote
1answer
15 views

retrieve matrix data to twig file

I create a section clientSection which I linked an matrix field like in this image: The field has two block types : clientImage which has an field clientImage and clientDescription which has an field ...
1
vote
1answer
40 views

Pull info from a Related field within Matrix > within Super Table

Ok, my mind is about to implode with this… any help on template syntax very welcome! I have 2 Sections: ‘artists’ and ‘schedules’ In the ‘schedules’ section I have a Matrix field called ‘...
0
votes
0answers
38 views

Entries search parameter for date value in matrix field no longer working in Craft 3

We have a large festival events site where each performance is stored in a matrix field called dates which uses a single block which has a datetime field (date only). So if an event is on 3 different ...
0
votes
1answer
30 views

Performance basics? BlogPost+Comments vs. One ever-expanding Matrix Field?

New to Craft, and unsure how it works under the hood. In terms of overall performance, I'm curious to know which of the following scenarios is the most performant approach in terms of DB queries and ...
0
votes
0answers
15 views

How can you add a default set of fields to each matrix block?

We have a common set of default parameter fields I'd like on each matrix block on top of whichever other fields are configured. I'm trying to avoid managing them manually on each matrix block. What's ...
1
vote
1answer
41 views

Front end form with Matrix won't add more than one row

I have Notification entry with sendTo field and nViewed matrix: - viewedBy = Users field, limit of 1 - viewedDateTime = Plain Text User's don't see whole front end form, just a 'Mark as Read' link. ...
0
votes
0answers
25 views

Best way to display relevant matrixblock fields when doing a sitewide search?

I'm building a custom search results page which returns not only the entries that contain the search query (searchQuery), but also, the actual text/content in which the search query was found. That ...
1
vote
1answer
49 views

Additional criteria to filter status of field passed into RelatedTo

I'm trying to save all the images related to an entry in a variable. I need the images that are added through a matrix field in the entry. I'm using the following code, but am then also getting images ...
1
vote
1answer
31 views

Need help with filling matrix images into CSS grid

I want to fill in shuffled images into a CSS grid as a project overview. The images come from a matrix and have 4 different formats. So I want to fill in a format A image into the fitting grid cell (...
1
vote
1answer
69 views

Matrix Error - “Field Limit is too big for your chosen Column Type”

I have a matrix field which is used a my main Body content field. The site has just been updated to the latest version of Craft and I tried to add a block to the matrix field but when i try to save it ...
1
vote
1answer
28 views

Updating a matrix row in an existing entry using a frontend form

I am trying to update a specific row in a matrix field using a frontend form, I created them using another form with each row following the [new1], [new2] etc. naming format, but I can't seem to get ...
0
votes
0answers
26 views

Any second field in Matrix block coming out as NULL

For some reason, any time I add a Matrix block and add a second field it doesn't show - value is NULL. I upgraded from craft 3.2 to 3.4 recently.
1
vote
3answers
53 views

Images of Matrix not loading

First time working with matrix fields. In this case to load images. But somehow I can't manage to fetch the url of the Images. I can get the title and id but not the url. Can someone point me to the ...
0
votes
0answers
25 views

Query Events by Matrix Field using Where clause

I am new to Craft CMS. I am able to get a list off all upcoming events with: $events = Calendar::getInstance()->events ->getEventQuery( [ 'calendar' => 'sample_calendar', ...
0
votes
0answers
52 views

Entry matrix field returns empty array

I have updated Craft from 3.3.15 to 3.4.2 version, and encountered the following problem. I have a form that creates entry which has matrix fields in it, entry is successfully saved in the database ...
0
votes
0answers
40 views

Eager loading showing duplicated DB query

So I've had a read on Eager loading on CraftCMS from an article by nystudio107 and begun enhancing my website for a client but I'm currently running into an issue which I'm not sure could be fixed or ...
1
vote
1answer
54 views

How to process Matrix field in controller

I am trying to process a text field inside a Matrix field. In the controller I have this to get posted params: $element->setFieldValuesFromRequest($fieldsLocation); If I want to process a custom ...
1
vote
2answers
81 views

Proper way to implement array of objects as Craft field

I'm using Craft CMS for the first time and have a question about the proper/best practice to store what would equate to an array of objects (or just a plain array) in Javascript or JSON. Say I'd like ...
0
votes
0answers
25 views

Immutable alternative to Matrix block id?

We're currently using this code to generate a class name that can be used to style a matrix block on the fly (ad-hoc): {% for item in matrix.all() %} <div class="page-builder__item-{{entry.id ?? ''...
0
votes
0answers
24 views

Matrix field not displaying after updating to Craft 3

According to the documentation, this should loop through all Matrix fields. {% for block in entry.fieldname.all() %} But it's showing nothing. Everything is showing in the CMS itself, but not on the ...
1
vote
0answers
33 views

Migrating to Matrix using Feed Me and Element API

How can I use Element API to move my entry fields into a matrix-based content builder? I'm going off the docs found at https://docs.craftcms.com/feed-me/v4/guides/importing-into-matrix.html#setup-your-...
0
votes
0answers
34 views

Craft 3 Programatically Adding Block Types To Matrix

I have been attempting to programatically add blocks to a matrix field using the below code as part of a larger plugin learning project. use craft\fields\Matrix; use craft\fields\PlainText; //Create ...
1
vote
0answers
34 views

Syntax for eager loading assets from multiple matrix block types

When eager loading assets from within a matrix block like so: {% set blocks = entry.relatedCategory .with([categoryBlocks.blockType.blockAssetField]) .all() %...
1
vote
2answers
156 views

Matrix field within a matrix field

I am working on a product page where I want to give the option to the user to select between which sections they want to use eg banner section, description section, video section etc. Now since the ...

1
2 3 4 5
12