Custom token didn't appear in options. Also, is my if/else correct?

I’m extremely rusty on doing any php coding, and I’m not quite sure how to reference fields from within a custom token (Drupal 8)

I think I might have it, but the token didn’t appear in my pop-up of options after enabling the module. Also, I’m not sure if I did the if-else statement correct.. or maybe somebody knows a better way. (for extra clarification: It’s a simple token to create a URL-safe replacement for a multiplication sign, so I can use that token in my pathauto patterns for the relevant node.)

Here’s what I got in the .yml: 

name: Hybrid x converter
type: module
description: 'converts hybrid symbol to an x where needed'
package: My Custom Module
core: 8.x

and the .module contains this: 

 * @file
 * contains custom token declaration script.
use DrupalCoreRenderBubbleablemetaData;
 * Implements hook_token_info().
function custom_token_token_info(){
  $types['custom_tokens'] = array(
    'name' => t("Custom Tokens"),
    'description' => t("Custom tokens"),

  $mytoken['hybrid_x'] = array(
    'name' => t("hybrid x converter"),
    'description' => t("switch 'times' symbol to x - for urls"),
  return array(
    'types' => $types,
    'tokens' => array(
      'custom_token' => $mytoken,

 * Implements hook_tokens().
function custom_tokens($type, $tokens, array $data, array $options, BubbleableMetaData $bubbleable_metadata) {
  $replacements = array();
  if($type == 'custom_tokens') {
    foreach ($tokens as $name => $original) {
        switch ($name) {
            case 'hybrid_x' :
                // if field has 'times' value
                $hybridmarker = ('[node:field_plant_hybrid_marker]');
                if ( $hybridmarker == "×") {
                    $text ="-x";
                } else {
                    $text ="";
                $replacments[$original] = $text;
                // close 
  return $replacements;
Drupal version: