You are here

class AddToHeadParamConverter in Add To Head 8

Hierarchy

Expanded class hierarchy of AddToHeadParamConverter

1 string reference to 'AddToHeadParamConverter'
add_to_head.services.yml in ./add_to_head.services.yml
add_to_head.services.yml
1 service uses AddToHeadParamConverter
add_to_head_profile in ./add_to_head.services.yml
Drupal\add_to_head\ParamConverter\AddToHeadParamConverter

File

src/ParamConverter/AddToHeadParamConverter.php, line 8

Namespace

Drupal\add_to_head\ParamConverter
View source
class AddToHeadParamConverter implements ParamConverterInterface {
  public function convert($value, $definition, $name, array $defaults) {
    $settings = add_to_head_get_settings();
    return array_key_exists($value, $settings) ? $settings[$value] : FALSE;
  }
  public function applies($definition, $name, Route $route) {

    // Stop this running on anything other than the add_to_head_profile type.
    // This breaks router items such as node/edit etc if we dont catch it.
    return isset($definition['type']) && $definition['type'] == 'add_to_head_profile' ? TRUE : FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AddToHeadParamConverter::applies public function Determines if the converter applies to a specific route and variable. Overrides ParamConverterInterface::applies
AddToHeadParamConverter::convert public function Converts path variables to their corresponding objects. Overrides ParamConverterInterface::convert