b/c break
PR-6.0-dev
Pending
User tests:
Successful:
Unsuccessful:
PR: Enhanced JsonapiView with Safe Custom Fields & Core Fixes
Summary
This PR improves the JsonapiView of com_content in the Joomla API by:
- Introducing a safe container for custom fields (
custom_fields) in both single item and list views.
- Fixing dynamic field injection — removed runtime injection and standardized fields to render.
- Enhanced preparation of items:
- Properly concatenates
introtext and fulltext for API output.
- Triggers
onContentPrepare for all content plugins.
- Safely processes custom fields with fallback to
rawvalue.
- Resolves tags consistently using
TagsHelper.
- Handles core images (
image_intro and image_fulltext) with proper URL resolution.
- Supports multilingual associations when
Multilanguage is enabled.
Key Changes
- Added
$fieldsToRenderItem and $fieldsToRenderList with custom_fields.
- Added
$relationship array including category, created_by, modified_by, tags, and multilingual associations.
- Updated
prepareItem() method for:
- Safe processing of custom fields.
- Safe conversion of images to array and URL resolution.
- Proper tags fetching.
- Multilingual association objects.
Benefits
- Ensures API consumers receive a consistent, safe, and complete dataset for articles.
- Fixes prior issues with dynamic field injection.
- Supports multilingual and tag-rich content seamlessly.
- Compatible with all current and future content plugins.
Notes
- No breaking changes for existing API consumers.
- Fully compatible with Joomla 4+ API component standards.
custom_fields are safely exposed via API without relying on internal raw properties.
sadiapeerzada
-
open
-
5 Mar 2026
sadiapeerzada
-
change
-
5 Mar 2026
bembelimen
-
change
-
6 Mar 2026
| Status |
Pending |
⇒ |
Closed |
| Closed_Date |
0000-00-00 00:00:00 |
⇒ |
2026-03-06 10:39:20 |
| Closed_By |
|
⇒ |
bembelimen |
| Labels |
Added:
b/c break
PR-6.0-dev
|
bembelimen
-
close
-
6 Mar 2026
Add a Comment
Login with GitHub to post a comment
@sadiapeerzada please fix the code style
i've made a quick test and your pr seems promising
{ "links": { "self": "http:\/\/localhost:7060\/api\/index.php\/v1\/content\/articles" }, "data": [ { "type": "articles", "id": "1", "attributes": { "id": 1, "asset_id": 101, "title": "test_imagesin_fileds", "alias": "test-imagesin-fileds", "state": 1, "access": 1, "created": "2026-03-05 10:44:12", "created_by": 657, "created_by_alias": "", "modified": "2026-03-06 08:16:29", "featured": 0, "language": "*", "hits": 0, "publish_up": "2026-03-05 10:44:12", "publish_down": null, "note": "", "images": { "image_intro": "http:\/\/localhost:7060\/images\/sampledata\/fruitshop\/apple.jpg#joomlaImage:\/\/local-images\/sampledata\/fruitshop\/apple.jpg?width=375&height=281", "image_intro_alt": "", "float_intro": "", "image_intro_caption": "", "image_fulltext": "http:\/\/localhost:7060\/images\/sampledata\/fruitshop\/bananas_2.jpg#joomlaImage:\/\/local-images\/sampledata\/fruitshop\/bananas_2.jpg?width=300&height=352", "image_fulltext_alt": "", "float_fulltext": "", "image_fulltext_caption": "" }, "metakey": "", "metadesc": "", "metadata": { "robots": "", "author": "", "rights": "" }, "version": 4, "featured_up": null, "featured_down": null, "typeAlias": "com_content.article", "text": " ", "custom_fields": { "images": "provaprova", "asset-id": "{\"imagefile\":\"images\\\/sampledata\\\/parks\\\/animals\\\/200px_phyllopteryx_taeniolatus1.jpg#joomlaImage:\\\/\\\/local-images\\\/sampledata\\\/parks\\\/animals\\\/200px_phyllopteryx_taeniolatus1.jpg?width=180&height=135\",\"alt_text\":\"\"}" }, "tags": [] }, "relationships": { "category": { "data": { "type": "categories", "id": "2" } }, "created_by": { "data": { "type": "users", "id": "657" } }, "tags": { "data": [] } } } ], "meta": { "total-pages": 1 } }