Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public function getFieldValues(BaseElementModel $entry, $fields = null)
{
foreach ($entry->fieldLayout->fields as $fieldLayoutField) {
$fieldHandle = $fieldLayoutField->field->handle;
if ($fields === null || in_array($fieldHandle, $fields)) {
$field[$fieldHandle] = $entry->getFieldValue($fieldHandle);
}
}
return $field;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment