Skip to main content
5 votes

Dynamic upload location for Super Table within a Matrix field?

Have you tried using {owner.owner.slug}? If you've got Matrix > Super Table > Asset, and you're trying to get an attribute on the Entry/Element, you'll need to go two level out from the Super Table ...
crawf's user avatar
  • 3,562
5 votes
Accepted

How to get a Super Table relation in PHP?

$element = Craft::$app->getUser()->getIdentity()->priceTable->relatedTo([ 'targetElement' => $product->id, 'field' => 'product' ])->one() But to be honest your code in ...
Robin Schambach's user avatar
4 votes
Accepted

Adding Columns to a table

With the supercool table maker you can create dynamic tables. Is this what you are looking for?
Robin Schambach's user avatar
4 votes
Accepted

Using Element API to output Super Table fields

Here is a solution I found. Define an empty array, then loop over it, providing whatever keys you want to return from the Super Table fields. Simply by looping over $block->columnTextBlocks (the ...
andrewmenich's user avatar
4 votes
Accepted

Editing SuperTable inside Matrix block

So you'll want to update the Super Table Block's content and to do that when in a Matrix field is a little tricky, but it can be done. $matrixBlocks = $entry->matrixField->all(); foreach ($...
crawf's user avatar
  • 3,562
3 votes

Craft 3 CP performance

Is this a problem with only the dashboard, or the front-end also? Although this is a bad answer, waiting a few seconds to load the dashboard shouldn't be a huge deal. You will only need to access it a ...
Clark Nelson's user avatar
3 votes
Accepted

Why is my Super Table field returning the ID for existing blocks?

I think the key thing here is that its a static Super Table field, which is treated differently to a repeatable one. Instead of looping through each block, there's only one. Fortunately, you have all ...
crawf's user avatar
  • 3,562
3 votes
Accepted

How can I loop through the values of a drop down within a SuperTable?

You'll likely want to do something like this: {% for fieldtype in blocktype.getFieldLayout.fields %} {% set field = fieldtype.field %} Handle: {{ field.handle }} {% if field.type == '...
crawf's user avatar
  • 3,562
3 votes
Accepted

How to show details on linked entry in CP (another field inside related entry)

Basically, what you want to do isn't possible – there's no hook for modifying the content in a relational field's input HTML. The getEntryTableAttributeHtml hook is meant for element indexes (such as ...
Mats Mikkel Rummelhoff's user avatar
3 votes
Accepted

Entries query by Super Table field

It's basically the same as Find entries that use a specific block in their Matrix field? You can use the base query and left join your Super Table content row {% set entries = craft .entries() ...
Robin Schambach's user avatar
3 votes

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

That's more complicated, because fields in a Matrix are scoped to the Matrix field, which is why you can't just go: {% set field = craft.fields.getFieldByHandle('superTableFieldInMatrix') %} You'll ...
crawf's user avatar
  • 3,562
3 votes
Accepted

SuperTable queries on fields in fields

I think I followed this breakdown, but a screenshot of the admin could be helpful as well if this answer isn't accurate... {% set speakers = entry.eventSpeakerList.all() %} {% for speaker in speakers ...
Trevor Davis's user avatar
3 votes
Accepted

Need to run the super table fix-content-tables from CLI

Under the hood, the Super Table fix is running a migration behind a controller, which you can call in a content migration directly in your project. I have done the same, due needing to script it in a ...
James White's user avatar
  • 1,171
2 votes
Accepted

Matrix -> Super Table - > Matrix

Firstly, you'll need to change: {% for row in superTableBlock %} to {% for row in block.superTableBlock %} So you can reference the Super Table field within your out Matrix field. You also don't ...
crawf's user avatar
  • 3,562
2 votes

How to use Super Table to create an Image Carousel?

Welcome to Craft! Is it essential that you use SuperTable for this? The behavior you are describing is exactly what Matrix fields are designed to do, so you could quite easily achieve this without ...
Jamie Wade's user avatar
  • 3,644
2 votes
Accepted

Related Entry within SuperTable

You can’t use this special Twig function to get reverse related entries at all, as you’re not dealing with reverse relations in that context. From a stageEvent entry you can just loop through the ...
carlcs's user avatar
  • 36.3k
2 votes

Can I eager load Super Table fields in a Matrix block?

This appears to have been added in the 0.4.7 release! View the original issue here. Note: I have not personally verified this functionality.
August Miller's user avatar
2 votes
Accepted

Remove duplicated entries from SuperTable related entries

The simplest way is to create a "filtered" array, containing the unique cables, and then loop through that. For example: {# Build the "filtered" array of cables #} {% set filteredCables = [] %} {% ...
Stephen Lewis's user avatar
2 votes
Accepted

Sort entries by custom date in Matrix field / Super Table

I did something like this as a workaround: Loop over entries, fetching all data you need and adding it to an array. Sorting that array with SuperSort and than displaying all info by looping over the ...
Tom De Smet's user avatar
  • 1,456
2 votes

Sorting SuperTable Field with SuperSort?

I think you need to add 'object' to your syntax if you're using {{ }}: {{ object.tourDates.tourDate }} Else it's { tourDates.tourDate } I believe. See the plugins docs under Advanced sorting.
Tom De Smet's user avatar
  • 1,456
2 votes
Accepted

Matrix Field Count Records

You mean how many rows the table has? {{ matrixblock.superTableFieldHandle|length }} Or the number of blocks of a matrix field? {{ parent.matrixFieldHandle|length }} To get the number of blocks ...
Robin Schambach's user avatar
2 votes
Accepted

SuperTable Field returning null

The reason the attribute for your Super Table is null is because the field is an element, which doesn't have 'simple' content. You'll find this is the exact same case for any other element like an ...
crawf's user avatar
  • 3,562
2 votes

Adding Columns to a table

I used the method described here: "A User-Friendly Table Field" http://www.drivesimplicity.com/blog/a-user-friendly-table-field -- instruct the user to leave columns that he/she doesn't want blank and ...
userAW's user avatar
  • 176
2 votes
Accepted

Is defined conditional passing, yet causes a "do not have a method or closure named" error

This is a weird twig behavior. You have to do if stRow['caption'] is defined to make it work because of the object syntax of twig. Sometimes the if defined statement becomes true when you don't use ...
Robin Schambach's user avatar
2 votes
Accepted

Set SuperTableFields programatically

So it looks like you must get the correct block type in order for this to create new rows in the SuperTable. First get the block type using the SuperTable service: //you'll need to reference ...
Piaras Hoban's user avatar
2 votes
Accepted

Bootstrap 4 Accordion with Matrix (and SuperTable)

I'd break up the forloops a bit so you're outputting the panel container and the accordion wrapper markup once. Then for each accordion (supertable row) you're outputting that markup as many times as ...
Jay's user avatar
  • 1,042
2 votes
Accepted

Craft CMS 3 data structure advice for vehicle make, model, trim, year tagging

Goal: Filter documents by related vehicle characteristics. My first idea would be to create it as such: Create an assets volume where all your documents will be uploaded to. Create a vehicle ...
Tom De Smet's user avatar
  • 1,456
2 votes
Accepted

Looping Related Entries with a Super Table

The issue is: you don't really loop your entries at all. {# get all super table rows #} {% set superTableRows = block.related.all %} {% if superTableRows is not empty %} <div class="{{ ...
Robin Schambach's user avatar
2 votes
Accepted

How to remove a Super Table row on the front end?

I got a solution! <input class="remove" type="hidden" name="fields[{{ fieldHandle }}][{{ row.id }}][type]" value="{{ blocktype }}"> So the output will be "1" if you change it to "0" and safe ...
Samuel's user avatar
  • 61
2 votes

How to place assets in plain text fields?

Matrix fields in Craft are much more powerful than EE. In EE each Matrix row has a single set of fields available to it (a limitation of using a table-based UI). But in Craft you can set up multiple “...
Brandon Kelly's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible