You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 26, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: system/user/addons/json/README.md
+57-16
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# JSON #
2
2
3
+
Output ExpressionEngine data in JSON format.
4
+
3
5
## Requirements
4
6
5
7
- ExpressionEngine 4.x, 5.x or 6.x
@@ -12,10 +14,9 @@
12
14
I don't own Assets, Matrix and Playa modules, so if you use Assets, Matrix or Playa fields I recommend to verify whether changes to the code are required and to test this plugin on a local or development server before using it on a production/live server.
13
15
Since this plugin only outputs data I don't expect any damage but I will not accept any liability for any problems risen from using this plugin.
14
16
15
-
***Do not select duplicate custom fields in channels***
17
+
***No duplicate custom fields in channels!***
16
18
17
-
Since EE4 it is possible to use custom fields outside of field groups as well as inside field groups. This plugin will not work when a new custom field is assigned as a standalone custom field as well as a grouped custom field within the same channel. You need to choose to use either a grouped custom field or a standalone custom field. This is because newly created custom fields get their own table in the database.
18
-
Since legacy custom fields do not have their own table they will work fine either way.
19
+
Since EE4 it is possible to use custom fields outside of field groups as well as inside field groups. This plugin will not work when a custom field is assigned as a standalone custom field as well as a grouped custom field within the same channel. You need to choose to use either a grouped custom field or a standalone custom field.
19
20
20
21
***Fluid fieldtype***
21
22
@@ -456,20 +457,15 @@ function yourCallbackFunction(data) {
456
457
457
458
## Changelog
458
459
459
-
### v2.5.1
460
-
461
-
- Bugfix: Removed all remnants of fluid field data, since the Fluid fieldtype is not (yet) supported the remnant data is unusable at this point. Working on support for Fluid fieldtype
462
-
- Bugfix: Updated the `members` function to fit EE6.x
463
-
-**Note:** not tested with Assets, Matrix, Playa and Channel Files fieldtypes/modules
464
-
465
460
### v2.5.0
466
461
467
-
- ExpressionEngine 4+ compatibility
462
+
- ExpressionEngine 4.x, 5.x or 6.x required
468
463
- Several changes to the code due to database changes
469
464
- Added support for File Grid fieldtype
470
-
- Added support for legacy custom fields and data (EE2 and EE3 custom fields and data) for compatibility with upgraded versions of EE4+
471
-
- Added `/system/user/addons/json/icon.png` for the EE6 control panel
472
-
-**Note:** not tested with Assets, Matrix, Playa and Channel Files fieldtypes/modules
465
+
- Added support for legacy custom fields and data (EE2 and EE3 custom fields and data)
466
+
- Added `/system/user/addons/json/icon.png` for the control panel
467
+
- Fluid fieldtype not supported
468
+
-**Note:** not tested with Assets, Matrix and Playa
473
469
474
470
### v1.1.9
475
471
@@ -479,8 +475,53 @@ function yourCallbackFunction(data) {
479
475
- Added `/system/user/addons/json/README.md` for the add-on manual in the control panel (as of EE3)
480
476
-**Note:** not tested with Assets, Matrix and Playa
481
477
482
-
## Attribution
478
+
### v1.1.8
479
+
480
+
- Added `json_plugin_entries_end` and `json_plugin_members_end` hooks
- Add `root_node` and `item_root_node` parameters.
495
+
496
+
### v1.1.4
497
+
498
+
- Add manipulations to Assets fields
499
+
500
+
### v1.1.3
501
+
502
+
- Fix bug where show_categories parameter did not work
503
+
504
+
### v1.1.2
505
+
506
+
- Fix bug where `fields` parameter was not being honored
507
+
- Fix bug causing fatal MySQL error when using the `fixed_order` parameter
508
+
509
+
### v1.1.1
510
+
511
+
- Fix WSOD on Plugins page
512
+
- Fix PHP errors when an Assests field has no selection(s)
513
+
514
+
### v1.1.0
515
+
516
+
- Added support for the following fieldtypes: Assets, Grid, Playa, Relationships
517
+
- Change IDs (entry_id, author_id, etc.) and Dates to integers
518
+
- Added `show_categories` and `show_category_group` parameters to `{exp:json:entries}`
519
+
- Added `{exp:json:search}`
520
+
- Added JSONP support
521
+
- Added `date_format` parameter
522
+
- Added `content_type` parameter
483
523
484
-
This plugin is a fork of the excellent [JSON plugin](https://github.com/rsanchez/json) by [Rob Sanchez](https://github.com/rsanchez).
524
+
## Upgrading from 1.0.x
485
525
486
-
Since I'm a jack of all trades and master of none, I could have never done this without the jumpstart Rob Sanchez's plugin gave me.
526
+
- IDs (entry_id, author_id, etc.) and Dates are returned as integers
527
+
- The following fieldtypes have different output: Playa, Assets. Please see docs above for an example of their output.
@@ -160,20 +158,19 @@ public function entries($entry_ids = null)
160
158
{
161
159
if (empty($this->fields) || in_array($field['field_name'], $this->fields))
162
160
{
163
-
164
-
if ( ee()->db->table_exists('channel_data_field_'.$field['field_id']) )
161
+
if ( ee()->db->table_exists('channel_data_field_'.$field['field_id']) ANDee()->db->field_exists('field_id_'.$field['field_id'], 'channel_data_field_'.$field['field_id']) )
165
162
{
166
163
$select[] = 'cdf_'.$field['field_id'].'.'.ee()->db->protect_identifiers('field_id_'.$field['field_id']).' AS '.ee()->db->protect_identifiers($field['field_name']);
167
164
}
168
-
// We got legacy channel data, let's get it
165
+
// Legacy data?
169
166
else
170
167
{
171
-
$select[] = 'lcd.'.ee()->db->protect_identifiers('field_id_'.$field['field_id']).' AS '.ee()->db->protect_identifiers($field['field_name']);
168
+
$select[] = 'cd.'.ee()->db->protect_identifiers('field_id_'.$field['field_id']).' AS '.ee()->db->protect_identifiers($field['field_name']);
172
169
}
173
170
}
174
171
}
175
172
176
-
//we need entry_id, always grab it
173
+
//we need entry_id, always grab it
177
174
if ( ! in_array('t.entry_id', $select))
178
175
{
179
176
$select[] = 't.entry_id';
@@ -188,19 +185,11 @@ public function entries($entry_ids = null)
0 commit comments