Skip to main content
added 312 characters in body
Source Link

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 "properly, though.

$disable = StcThreePairs::find()
    ->where(['elementId' => $pair->id])
    ->one();

$disable->field_active = 0;
$disable->save();

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?

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 "properly, though.

$disable = StcThreePairs::find()
    ->where(['elementId' => $pair->id])
    ->one();

$disable->field_active = 0;
$disable->save();
Source Link

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?