Editing SuperTable inside Matrix block I have a matrix field set up as global (strategies).
Inside each matrix block there is a SuperTable (pairs)
On each row in the SuperTable there is a lightswitch (active)
I need to toggle the lightswitch programatically for each row.
Looking at the SuperTable and Craft docs, I still can't make heads or tails of this. Can anyone help?
Edit
Ended up with a poor man's solution by going directly to the table and editing the column. Would still love to know how to do this &quot;properly, though.
$disable = StcThreePairs::find()
    -&gt;where(['elementId' =&gt; $pair-&gt;id])
    -&gt;one();

$disable-&gt;field_active = 0;
$disable-&gt;save();
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-&gt;matrixField-&gt;all();

foreach ($matrixBlocks as $matrixBlock) {
    $superTableBlocks = $matrixBlock-&gt;superTableField-&gt;all();

    foreach ($superTableBlocks as $superTableBlock) {
        $superTableBlock-&gt;setFieldValues(['lightswitchField' =&gt; true]);

        Craft::$app-&gt;getElements()-&gt;saveElement($superTableBlock);
    }
}