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
12 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
13 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
71 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
30 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
20 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
9 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
23 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
24 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
28 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
91 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
17 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
12 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
20 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
31 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
116 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
17 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
33 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
159 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
42 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
37 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
34 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
93 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
21 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
40 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
66 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
63 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
42 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
69 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
60 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
60 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
196 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
104 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
51 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
76 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
75 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
133 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 ...
1
vote
1answer
46 views

Display a Matrix field block entry when the block's entry exists

I have a videoPost block in a Matrix field. Each videoPost has a imageField. I am trying to display the block’s image if imageField is defined. This is returning images for each block that has ...
1
vote
1answer
51 views

filter matrix blocks by multiple light switch value, and then merge them

I have a (Craft 3) matrix field with two different block types that each have a similar light switch field that I want to use to create anchor links on my page. I need to be able to test whether any ...
0
votes
0answers
52 views

Indirect Relationship defined in Matrix Block

I have 3 channels: Reviews, Products and UseCases. In the section "Reviews" an entry has a list of "Products", based on a matrix field. Every block in this matrix field represents one listed "Product"...
1
vote
1answer
49 views

How to wrap a matrix blocktype occurrence loop inside a ul?

I made a template including a matrix field. I want to wrap all occurrences of a certain block type into a <ul> element. How can I do this? My current code: {% for block in entry.matrixField....
1
vote
1answer
23 views

How to filter relational field types on their related content's status?

I have a Matrix field on Users. In that Matrix field is an Entries field. I need to pull all Entries from that field, regardless of the related Entries status. The following code returns Users but ...
1
vote
1answer
71 views

Check if the first block in a Matrix field matches one of an array of types

I need to check if the first block in a Matrix field matches one of an array of types. Here's a simplified version of my code: {% if entry.newsArticleContent.one().type in ['fullWidthImage', '...
1
vote
1answer
69 views

includeJs not consistently working

Using Craft 2 and I have a Matrix Block which can contain a carousel item, which uses JS/jQuery. Because the content editor can add multiple instances of this Matrix Block I can’t set up these ...
3
votes
1answer
104 views

How to print all possible options of a dropdown field inside of a Matrix field?

I'm asking this outside an entry context. My starting point is {% set field = craft.app.fields.getFieldByHandle('matrixFieldHandle') %} When I print the data of the field, I find nothing ...