I have a plugin that wants to set a value for an entries existing matrix field, from a form on the font-end. Think of it like:
Movies (matrix field) Movie (matrix block) Name (plain text) votes (plain text) Movie (matrix block) Name (plain text) votes (plain text)
I want to increment the number of votes when a user clicks a button for a particular movie.
I've tried all sorts of methods, but being pretty novice at php I just can't seem to grasp how Craft is storing everything. I just keep getting back an array of ALL fields on the site, rather than the specific ones I'm searching for.
All existing SE questions seem to relate to adding new rows, I just want to edit an existing one.
Normal fields are (from existing code) along the lines of
$currentVotes = $movie->getFieldValue('votes'); $movie->setFieldValue('votes', $currentVotes + 1);
Which seems rather simple. What is the Matrix version of that?