We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [matrix]

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

Filter by
Sorted by
Tagged with
1
vote
3answers
28 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
30 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
8 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
32 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
16 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
40 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
21 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
30 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
20 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
5 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
14 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
75 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
35 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
21 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
12 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
40 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
52 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
36 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
135 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
23 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
13 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
25 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
37 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
121 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
21 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
18 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
36 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
161 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
52 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
vote
2answers
42 views

Sprout Reports plugin - How to output a Matrix field into a row

I'm not clear on how I would iterate over a Matrix field to be able to include the content in the row. Wish there was an example in the docs: https://sprout.barrelstrengthdesign.com/docs/reports/...
1
vote
1answer
38 views

Page with Matrix field slow to load

I am fairly new to Craft CMS but have a good understanding of it. I have a page that has a Matrix field to display staff photos and their roles. On the initial load of this page, it is slow, it takes ...
1
vote
1answer
25 views

Craft 3 - Matrix Block for currentUser

I have a Matrix field named -> certificado with block -> certificados and fields -> nomeDoCurso, curso, certificado My Matrix block has no entries but is associated with a user. How can I fetch ...
1
vote
1answer
124 views

Matrix Field - variable entry does not exist

I'm trying to loop a Matrix field that has one block containing 3 items. {% for block in entry.galeria.type('itemsGaleria') %} {% if block.titulo|length %} {{ block.titulo.first }} {% ...
1
vote
1answer
22 views

Entries Field Type showing all entries instead of entries selected

I am new to craft and twig and need some help showing only added entries to matrix block. What I have now is showing all entries from the section. I may be going about this all wrong, I don't know. I ...
1
vote
1answer
42 views

Craft 3: fetching a single Matrix row by its dropdown field value

I have 2 Matrix fields in an entry type, both of which use Dropdown fields: Matrix: urls address (block type) context (dropdown field values include 'own') address urn ...
1
vote
1answer
79 views

Templating repeatable blocks in a matrix field

I have a matrix field that has two different block types. The matrix field is on an entry that lists a number of benefits for a given product on a corporate website. The two different blocks are ...
1
vote
1answer
68 views

Passing optional variable values into an include template

Craft noob here. I have an include file which I'm calling a "component" so I can reuse it across the site. The component is set up like this. <h2>{{ heading }}</h2> {{ bodyContent }} {% ...
1
vote
0answers
43 views

Order entries by a matrix field category

I have a lot of trouble in understanding the database/model structure and how to work with the query builder. I tried playing a bit with leftJoins but i cannot seem to make complex queries in craft 3. ...
1
vote
2answers
77 views

Removing old Block Handles in Matrix Field?

I'm working with Matrix field. When adding and then removing and then adding again fields with the same handle I get the following error. Handle "videoUrl" has already been taken. Is there a way of ...
2
votes
1answer
76 views

Tabs in a Matrix Field

In this video it looks like Courtney has tabs (Content | Design) in the individual fields in a Matrix. I can't work out how to do this, is it a plugin? It seems a great way of organising the fields ...
1
vote
1answer
71 views

How to duplicate a matrix field programatically in Craft 3.1?

Is there a "Craft" way of handling this in 3.1? Solutions to this question on SE are based on older versions of Craft which no longer work. Custom fields can be duplicated by doing: $newEntry->...
1
vote
3answers
247 views

Matrix fields in an entry form

I'm attempting to get matrix fields to populate in an entry form (using the guest post plugin) and so far just can't seem to crack it. I've tried various examples, but all assume that you're just ...
1
vote
0answers
77 views

Craft 3: Possible to merge checkbox and text values from a frontend form and put into a plaintext Craft field?

Is it possible to submit checkbox array and text values on a front end form into a plaintext Craft field in Craft 3? My solution worked in Craft 2 but it broke in Craft 3 due to some under the hood ...
1
vote
1answer
49 views

Query returns nothing on matrixBlock

I'm a bit confused by the way that Craft now handles Matrix blocks. I've read the documentation a few times and I'm still not sure if I have it. Here's what I have: {% set myMatrixBlockQuery = craft....
1
vote
1answer
111 views

Can't link to entries or assets via a Redactor field

When using a Redactor field for a section, I can’t upload assets or link to entries. I just get an empty modal with no ability to select a section or asset folder. Thoughts on what I’m doing wrong? [...
1
vote
1answer
63 views

How to output 'selected' checkbox labels within a matrix

Newbie here. First Craft 3 CMS build and fumbling with logic of Matrix blocks. I've created a relatively simple matrix field, and I can output plain text and dropdown options, but not sure how to do ...
2
votes
1answer
88 views

Empty matrix object after checking for a block type

Not sure if this is a bug or my logic is off. I'm trying to add caching logic to templates to not cache certain pages if they have a block type form present because of the dynamic CSRF tokens. The ...
2
votes
1answer
82 views

Updating matrix field from font-end with $entry->setFieldValue() pulls in Cp bundle on save

I have an entry with a matrix field which I'm updating from front-end. The update works fine, but when the (font-end) page reloads after submitting the form, the CP bundle assets get included (...
1
vote
1answer
158 views

How to copy Matrix from one entry to another in Craft 3

I've got $entryA with a Matrix field. I want to programatically create a new $entryB and copy the Matrix field from $entryA to $entryB. How do I go about this?
1
vote
0answers
26 views

Why does calling matrix block type before matrix block loop lead to no loop output

In the code below I am trying to check for the presence of a quote block to help define some layout columns. As soon as i count an individual block, the loop block below it outputs nothing. If remove ...