bobbingwide / oik-bob-bing-wide

More lazy smart shortcodes
https://www.oik-plugins.com/oik-plugins/oik-bob-bing-wide-more-lazy-smart-shortcodes/
GNU General Public License v2.0
2 stars 0 forks source link

Improve oik-bbw/github block to be Server Side Rendered #47

Closed bobbingwide closed 2 years ago

bobbingwide commented 2 years ago

The current version of the GitHub block supports setting of text and background colours and also size.

image

The block needs to be improved.

Requirements

Proposed solution

Implementation steps similar to above...

bobbingwide commented 2 years ago

Make the block dynamic using Server Side Rendering rather than generating the [github] shortcode

I made the change, or so I thought, but got 404's from the render request.

Problem determination

  1. Check you've added the dynamic server function
    $args = [ 'render_callback' => 'oik_bob_bing_wide_dynamic_block_github'];
  2. Check the block name being requested is the same oik-bbw/github
  3. Implement some tracing to see what's happening. Why's it working for oik-bbw/csv
  4. Revisit step 1.
    $args = [ 'render_callback' => 'oik_bob_bing_wide_dynamic_block_github'];   
    $registered = register_block_type_from_metadata( __DIR__ .'/src/github' );
  5. It would be a good idea to pass $args to the block registration wouldn't it.

Say $args out loud, with a silent s.

bobbingwide commented 2 years ago

Attempt to support deprecation.

I think I did it this time.

Remove the redundant, hardcoded header

The redundant header is still needed for the deprecated version though.

Make the block dynamic using JavaScript in the editor and Server Side Rendering in the backend.

We can now:

bobbingwide commented 2 years ago

Delivered in v2.2.1.