Feature #18585


Feature #18192: CV "top" section

CV shortlink / block

Added by Boone Gorges 4 months ago. Updated 23 days ago.

Testing Required
Priority name:
Category name:
Target version:
Start date:
Due date:
% Done:


Estimated time:
Deployment actions:


This is a ticket for tracking the cv-shortlink block on the new CV editor.


Peek 2023-08-11 10-25.gif (93.9 KB) Peek 2023-08-11 10-25.gif Boone Gorges, 2023-08-11 11:45 AM
Actions #1

Updated by Boone Gorges 4 months ago

A first pass at this feature is ready for testing.

I mostly replicated the behavior of the existing tool. See attached gif. I tried to give some visual indicators of edit mode (the grey background, the fixed-width font) as well as of success/failure (changing the monospace font background color).

The Blocks Everywhere implementation means that the save routines are truly wacky. I have to do a separate AJAX fetch of the cac-cv object in order to get the necessary data available via register_rest_field(). In addition, it's not possible in Gutenberg to hook into the Save routine, so I couldn't set up a separate AJAX request to save the shortlink. Instead, I piggyback on the main post save, and parse the attributes using parse_blocks() in order to get the new shortlink. To enforce consistency in case of failed shortlink creation, I then override the saved attribute with the value from usermeta when the cac-cv post is loaded via REST. It's very messy but I couldn't figure out a better way to work around the limitations of Gutenberg, Blocks Everywhere, and the way that we store and validate the information.

Actions #2

Updated by Boone Gorges about 2 months ago

  • Target version changed from 2.2.0 to 2.3.0
Actions #3

Updated by Boone Gorges 23 days ago

In response to Sara's comment at

2. The short URL: Is this URL already established before editing? mine showed up blank but editable as if you could type it in. When I hit publish, this field still did not visually populate with the URL /scannon but when I went back to the account settings and viewed it, it populated that field.

I've changed the behavior so that when creating a new CV, the block will check to see whether the shorturl corresponding to your user nicename is available for use. If so, it will fill it in. If not, nothing will be filled in unless you manually do so. I think this is a decent workflow that will cover most cases.


Also available in: Atom PDF