addEditor() public method

Adds an editor resolver, identified by a string name, and that may be a string path, or a callable resolver. If the callable returns a string, it will be set as the file reference's href attribute.
public addEditor ( string $identifier, string $resolver )
$identifier string
$resolver string
Example #1
0
 /**
  * @param array $values Optional arguments for container.
  */
 public function __construct($values = array())
 {
     $defaults = array();
     $defaults['tables'] = array('$wp' => function () {
         global $wp;
         if (!$wp instanceof \WP) {
             return array();
         }
         $output = get_object_vars($wp);
         unset($output['private_query_vars']);
         unset($output['public_query_vars']);
         return array_filter($output);
     }, '$wp_query' => function () {
         global $wp_query;
         if (!$wp_query instanceof \WP_Query) {
             return array();
         }
         $output = get_object_vars($wp_query);
         $output['query_vars'] = array_filter($output['query_vars']);
         unset($output['posts']);
         unset($output['post']);
         return array_filter($output);
     }, '$post' => function () {
         $post = get_post();
         if (!$post instanceof \WP_Post) {
             return array();
         }
         return get_object_vars($post);
     });
     $defaults['handler.pretty'] = function ($plugin) {
         $handler = new PrettyPageHandler();
         foreach ($plugin['tables'] as $name => $callback) {
             $handler->addDataTableCallback($name, $callback);
         }
         // Requires Remote Call plugin.
         $handler->addEditor('phpstorm-remote-call', 'http://localhost:8091?message=%file:%line');
         return $handler;
     };
     $defaults['handler.json'] = function () {
         $handler = new Admin_Ajax_Handler();
         $handler->addTraceToOutput(true);
         return $handler;
     };
     $defaults['run'] = function ($plugin) {
         $run = new Run();
         $run->pushHandler($plugin['handler.pretty']);
         $run->pushHandler($plugin['handler.json']);
         return $run;
     };
     parent::__construct(array_merge($defaults, $values));
 }