We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can i print content for each field using PHP?
There is my code:
// Get Entry $enties = Entry::findOne(['id' => 1525, 'siteId' => 7])->contentBlocks->all(); // Get SuperTable block types $stFields = Craft::$app->getFields()->getAllFields( 'superTableBlockType:' . SuperTable::$plugin->getService()->getBlockTypesByFieldId($field->id)[0]->uid ); // Print each SuperTable fielId and fieldHandle foreach ($stFields as $stField) { print $stField->id . " " . $stField->handle . "\n"; }
Thaks.
No response
The text was updated successfully, but these errors were encountered:
There's an example on the docs, but it's really just like Twig
$entry = Entry::find()->id(1234)->one(); foreach ($entry->mySuperTableField->all() as $block) { foreach ($block->getFieldLayout()->getCustomFields() as $field) { $value = $block->getFieldValue($field->handle); var_dump($value); } }
If you know the field you want to fetch content for, that's simpler.
$entry = Entry::find()->id(1234)->one(); foreach ($entry->mySuperTableField->all() as $block) { $value = $block->myFieldHandle; }
Sorry, something went wrong.
No branches or pull requests
Question
How can i print content for each field using PHP?
There is my code:
Thaks.
Additional context
No response
The text was updated successfully, but these errors were encountered: