1. cliveportman
  2. /code
  3. /get-content-from-a-craft-cms-matrix-block-within-a-plugin

Get content from a Craft CMS matrix block within a plugin

You need to know the block ID (I'm getting it from the Post).

// get the matrix block
$block = craft()->matrix->getBlockById($blockId']);
// get the custom field
$customField = $block->getFieldValue('customFieldName');

Hat tip, but beware the getFieldValue shortcut described by Brandon didn't work for me. That might be because my matrix field is tied to a Craft Commerce order, not a standard entry.