#43931 closed enhancement (fixed)
Use associative array instead of numeric for exporters and erasers
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.9.6 | Priority: | high |
Severity: | normal | Version: | |
Component: | Privacy | Keywords: | gdpr fixed-major |
Focuses: | Cc: |
Description
In https://core.trac.wordpress.org/ticket/43438#comment:34, it was suggested to use associative keys for the personal data exporters.
I think this is a good idea and should be done (and something that has to be done before the first iteration of these features is released).
Say a plugin adds their exporter, but they add it at the beginning of the list using array_unshift()
. Or, a plugin just reorders the exporters. If a plugin hardcodes a change to the exporter at index 2
, that is now inconsistent.
Using associative keys also allows things to be changed without having to iterate over every exporter in the list to find the one you need.
Attachments (4)
Change History (21)
This ticket was mentioned in Slack in #gdpr-compliance by desrosj. View the logs.
7 years ago
#3
@
7 years ago
Although plugins can continue to just push onto the exporter or eraser arrays in the filters, it would be better (for consistency) if they now used a slug, e.g.:
<?php function register_my_plugin_exporter( $exporters ) { $exporters['comment-location-plugin'] = array( 'exporter_friendly_name' => __( 'Comment Location Plugin' ), 'callback' => 'my_plugin_exporter', ); return $exporters; }
#4
@
7 years ago
- Keywords needs-patch added; has-patch needs-testing removed
- Type changed from defect (bug) to enhancement
#6
follow-up:
↓ 7
@
7 years ago
- Priority changed from normal to high
The wp_privacy_personal_data_erasure_page
filter should probably be changed to include the slug of the erasure instead of an arbitrary index number
Although plugins can continue to just push onto the exporter or eraser arrays in the filters, it would be better (for consistency) if they now used a slug,
Since this is a new API we can and should enforce that. This would simplify some of the odd error messages like "index cannot be less than one." or "index is out of range".
This should be solved before the first beta gets released.
#7
in reply to:
↑ 6
@
7 years ago
Replying to ocean90:
The
wp_privacy_personal_data_erasure_page
filter should probably be changed to include the slug of the erasure instead of an arbitrary index number
Although plugins can continue to just push onto the exporter or eraser arrays in the filters, it would be better (for consistency) if they now used a slug,
Since this is a new API we can and should enforce that. This would simplify some of the odd error messages like "index cannot be less than one." or "index is out of range".
This should be solved before the first beta gets released.
Good idea. Working this now.
#9
@
7 years ago
43931.3.diff adds to 43931.2.diff by updating the error messages to use the text key instead of the numeric key.
This ticket was mentioned in Slack in #core by desrosj. View the logs.
7 years ago
This ticket was mentioned in Slack in #gdpr-compliance by iandunn. View the logs.
7 years ago
#14
@
7 years ago
- Owner set to iandunn
- Resolution set to fixed
- Status changed from new to closed
In 43154:
Change exporter and eraser arrays to associative arrays