Skip to content

Some fixes to get underpin 2.0 working with Nicholas 1.1 #4

@josh-tt

Description

@josh-tt

After banging my head against the wall all day, I think I was able to finally get Nicholas 1.1 working with Underpin 2.0. It does not work out of the box and there appear to be a few show stoppers.

In Nicholas.php

  1. I think you need the new ::logger
    Header seems to require:
    use Underpin\Loaders\Logger
    Replace the old logger with the new one (not sure if 100% necessary, though was causing errors with other underpin modules like the style loader):
nicholas()->logger()->log_wp_error( 'error', $error, [
			// 	'ref'     => $endpoint,
			// 	'context' => 'endpoint',
			// 	'params'  => $params,
			// ] );

With:
Logger::log_wp_error( 'error', $error, [ 'ref' => $endpoint, 'context' => 'endpoint', 'params' => $params, ] );

  1. The rest endpoints need to have namespace updated to Rest not Rest_Endpoints:
    $this->rest_endpoints()->add( 'page_data', 'Nicholas\**Rest**\Page_Data' );
  2. Not sure, but perhaps use Underpin\Traits\Feature_Extension needs to be in the heade of Rest_Endpoing.php and/or in Nicholas.php? That seemed missing when testing a standard setup based of your demos on the rest_endpoint GitHub page and was throwing an error without it, though I'm not sure if it's required for Nicholas.

Will see tomorrow if that was it or if more fixes required. Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions