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
10 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
36 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
25 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
27 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
21 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
24 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
52 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
18 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
37 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
20 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
36 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
37 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
22 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
22 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 ...
0
votes
0answers
18 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
22 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 ...
0
votes
0answers
21 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
80 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 ...
0
votes
0answers
20 views

Missing Matrix content after upgrading from Craft2 to Craft3

I’m upgrading my Craft2 blog to Craft3 at https://brill.blog. I’ve got a loop to display text, images, and block quotes from a Matrix field, that follows this pattern: {% for block in entry....
2
votes
1answer
37 views

Link to a nested category

I'm using a matrix field to allow the author to add products they can link to category pages, but my code: {% for block in entry.transformerProductNavigation %} <a href="{{ block.transformer.one....
0
votes
0answers
40 views

Supertable or Neo for nested Matrices and compatibility with Craft 4

I typically avoid using Supertable or Neo because I don't want the extra dependency going forward. However I'm in a project where I needed nested matrices. I know that in C4 nested matrices will be ...
1
vote
3answers
46 views

How can I restore Matrix content after accidentally changing its field type?

We accidentally deleted all our body text on all our pages, how do I redo my website to a older version. (24 hours ago) We changed matrix to assets and after that every body text disappeared.
1
vote
2answers
40 views

Matrix loop (nesting?) issue using switch

First let me say this: I'm new to Craft and Twig. So: my apologies for probably overlooking the obvious. I hope you can offer me some help... I've been trying for a couple of days to solve this puzzle....
0
votes
0answers
11 views

How to create other sites entries with same data, when “Save blocks to other sites in the same group” is used

We have fields, including a matrix field, that is set to "Save blocks to other sites in the same group". This means when we edit our English group, only sites in that group are edited, so they all ...
1
vote
1answer
49 views

Template output when grouping matrix blocks

I have a shared content builder matrix field that has the usual blocks: Redactor, Headings, Images, etc. A typical entry might look like this: - Heading - Redactor - Image - Redactor - Heading - ...
1
vote
1answer
23 views

Access Matrix field that is assigned to a user

Using Craft 3. I created the following field: myMatrix which has Field Type = matrix and is part of the group myGroup This is composed of one block: myMatrixBlock with 2 fields: myMatrixField1 ...
1
vote
1answer
82 views

In entries query, is there a way to check if matrix block is used?

I would like to get entries if a matrix field is used. Something like this: {% set query = craft.entries() .section('blog') .search('myMatrixField|length') .limit(10) %}
1
vote
1answer
29 views

Order grouped results by dropdown order

Following this topic, I have an additional question. The results are not ordered by the order of the Dropdown Options. How can I get this done? Code: {% set players = entry.myPlayersMatrix %} {% ...
0
votes
1answer
39 views

Removing a matrix row via front end entry form

Read some similar posts on here but they don't quite solve my problem. I've gt an entry form with a matrix field in it, and I’m trying to make it editable via front end entry form. Specifically I'd ...
0
votes
0answers
79 views

Feed me - Trouble importing table and matrix with translation

I'm trying to import entries to a chanell using Feed me but having some issues with table and with some multilingual texte in a matrix field. Craft edition & version Craft Pro 3.3.2 Feed Me 4....
0
votes
0answers
8 views

Craft 3 Matrix Field customFields property 'required' and 'sortOrder' fields null

I'm trying to dynamically build a frontend form based on a Matrix field. I'm iterating over the entry.aMatrixField.customFields array which returns me an array of field objects in Twig. The field ...
1
vote
1answer
20 views

relatedTo a category in a matrix field

All, I'm very close, but missing something and any help is appreciated. I have a teamMember matrix block allowing me to add employees with some basic info. One of the fields is a category field called ...
1
vote
1answer
89 views

How to search a matrix block with a specific handle?

I want to query a specific matrix block using text search which will search all the searchable fields in that particular block and give me output in the form of blocks that I can further process. I ...
0
votes
0answers
41 views

Set field value of table field within matrix in a module?

I have a matrix called 'Election' with the structure: Block: role - Text field: roleName - Table field: candidates -- Text field: fullName -- Number field: votes My module can edit the roleName ...
1
vote
1answer
23 views

Module Development - Get ID of a field within a Matrix field

I have a matrix field that has a Supertable matrix within it. I need to programatically get the ID of the field that is nested in the Matrix. I have the code below: $matrixField = Craft::$app->...
0
votes
0answers
17 views

SQL to delete all entries and a matrix field from the database direct due to Craft issues in the admin

What would be safe SQL commands to delete all entries from the database? And similarly to delete all content from a specific Matrix field? The reason is because Craft seems to have an issue with ...
0
votes
0answers
85 views

Queue “Failed”, with Attempting to save an element in an unsupported site

I have many sites for different countries and languages. They are grouped by language. I have a matrix field setup to "Save sites to other sites in the same site group". We imported all the sites ...
1
vote
1answer
136 views

How to find the block type of Super Table field that is inside a Matrix field

I'm making a front-end entry form with a Super Table field that is inside a Matrix field. Super Table docs at https://verbb.io/craft-plugins/super-table/docs/template-guides/front-end-form have an ...
1
vote
0answers
51 views

Importing set of flat fields into multi-row matrix using Feed Me

I'm using 'Feed Me' in Craft 3 to import data. The data has 9 fields (like full_name_child_1, and gender_child_1...) and has 10 sets of them (all the way to full_name_child_10, etc). I originally ...
1
vote
3answers
304 views

Show Entries based on content in a Matrix Field

I have a product with a variant matrix field(productVariants). Inside each variant is the option to supply a sale price (salePrice). On the front end, I'm trying to show a product grid of only ...
0
votes
0answers
28 views

Add Matrix Blocks to existing Entry with Form without discarding existing Matrix Blocks

When I want to save an new Matrix block with an form to an existing Entry: <form method="post" accept-charset="UTF-8"> {{ csrfInput() }} <input type="hidden" name="action" value="entries/...
0
votes
0answers
15 views

How do I change sortOrders for a matrix field from the frontend?

I have a frontend form working that is successfully saving new blocks to a Matrix field (the field has only one block type). When sending the form data to Craft I am also sending a new sortOrder value ...
0
votes
0answers
36 views

Matrix Block query next prev

Good afternoon, Is it possible to have a next prev button to cycle through a number of matrix blocks within a single entry and show the blocks content individually on screen? The block contains an ...
1
vote
1answer
40 views

Filter and sort Commerce products based on Matrix blocks

We have a website that uses Craft CMS v3.1.28 and Commerce v2.1.6.1. The below logic is implemented within a plugin and we're prepared to do custom implementations aka. prepared to go deep! I would ...
1
vote
1answer
132 views

How can I query entries based on a Matrix Block Type?

I'm using Element API and trying to create a query that returns a list of entries based on if the entry is using a specific Matrix Block Type. I've tried a few different things including a query that ...
0
votes
0answers
24 views

Setting a variable to a Matrix field with additional parameters

I'm trying to set a variable to a Matrix field and apply additional query parameters like so: {% set monthDates = entry.scanDates.type('dates').date('and', '>= ' ~ currMonthFirst|date('Y-m-d'), '&...
0
votes
0answers
22 views

Possible to move matrix content from one global set to another

Is it possible within the database to manipulate a couple of keys to move matrix content to another global set without having to re-enter it all in Craft 3? I have the matrix field in both global ...
0
votes
1answer
46 views

Element API unable to get all() of matrix field

I'm getting matrix block content from an entry type which works fine for the most part. It's probably clearer to just paste in the code: Current element api code: $relationsData = []; if($entry-&...
2
votes
1answer
168 views

Loop through Matrix Block fields within a Switch Case and retain HTML structure

I'm struggling to get my head around the syntax to output information in a correct HTML structure. At the moment I have this: {% for block in entry.menuBuilder %} {% switch block.type %} {% case '...
1
vote
0answers
85 views

How to exclude a Matrix block from search?

I'm using a Matrix field as a content builder, allowing the editor to freely create content blocks, titles, images, etc, etc. All of which is content that is required to be searched. But also included ...

1
2 3 4 5
12