Make WordPress Core

#60358 closed enhancement (fixed)

Add: Add original_source and author_text to the templates rest API.

Reported by: jorgefilipecosta's profile jorgefilipecosta Owned by: jorgefilipecosta's profile jorgefilipecosta
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch has-unit-tests add-to-field-guide
Focuses: Cc:

Description

For the new "All templates" UI to work properly we need the REST API to provide to additional fields original_source, and author_text.
This ticket tracks its addition to the core.

It ports the following PRs from the Gutenberg repository:
https://github.com/WordPress/gutenberg/pull/56333
https://github.com/WordPress/gutenberg/pull/56567
https://github.com/WordPress/gutenberg/pull/56990

GitHub PR for the patch at https://github.com/WordPress/wordpress-develop/pull/5940.

Attachments (1)

60358.diff (2.1 KB) - added by david.binda 12 months ago.

Download all attachments as: .zip

Change History (10)

This ticket was mentioned in PR #5940 on WordPress/wordpress-develop by @jorgefilipecosta.


12 months ago
#1

  • Keywords has-unit-tests added

This PR adds the fields author_text and original source to the template rest API.
Backports into the core https://github.com/WordPress/gutenberg/pull/56333/, https://github.com/WordPress/gutenberg/pull/56567/, and https://github.com/WordPress/gutenberg/pull/56990.

#2 @jorgefilipecosta
12 months ago

  • Owner set to jorgefilipecosta
  • Resolution set to fixed
  • Status changed from new to closed

In 57366:

Editor: Add original_source and author_text to the templates REST API.

For the new "All templates" UI to work properly we need the REST API to provide to additional fields original_source, and author_text.

Props ntsekouras, get_dave.
Fixes #60358.

#4 @kebbet
12 months ago

Please milestone this ticket to 6.5 since [57366] was committed to trunk during this milestone period. Thanks @gefilipecosta!

#5 @sabernhardt
12 months ago

  • Milestone changed from Awaiting Review to 6.5

#6 @jorgefilipecosta
12 months ago

In 57374:

Coding Standards: Remove unnecessary access and internal annotations from two functions in WP_REST_Templates_Controller.

This commit removes unnecessary access and internal annotations from two functions that are private and as such don't require the annotation. It also adds the since annotation with the 6.5 release given that the annotation may be useful.

Props swissspidy.
See #60358.

#7 @david.binda
12 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Sorry for re-opening the ticket, but I have noticed a minor issue in the modified PHPUnit tests introduced in r57374 .

The newly expected original_source and author_text fields should have more appropriate message passed to the assertArrayHasKey method, but have a copy of the message used for the parent field.

See the attached diff.

@david.binda
12 months ago

#8 @stevenlinx
12 months ago

  • Keywords add-to-field-guide added

#9 @swissspidy
11 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 57710:

Tests: Update incorrect assertion message added in [57366].

Props david.binda.
Fixes #60358.

Note: See TracTickets for help on using tickets.