Interim commit.
[yaffs-website] / web / modules / contrib / hacked / src / ParamConverter / HackedProjectConverter.php
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\hacked\ParamConverter\HackedProjectConverter.
6  */
7
8 namespace Drupal\hacked\ParamConverter;
9
10 use Drupal\Core\ParamConverter\ParamConverterInterface;
11 use Drupal\hacked\hackedProject;
12 use Symfony\Component\Routing\Route;
13
14 /**
15  * Parameter converter for upcasting entity ids to full objects.
16  */
17 class HackedProjectConverter implements ParamConverterInterface {
18
19   /**
20    * {@inheritdoc}
21    */
22   public function convert($value, $definition, $name, array $defaults) {
23     return new hackedProject($value);
24   }
25
26   /**
27    * {@inheritdoc}
28    */
29   public function applies($definition, $name, Route $route) {
30     return (!empty($definition['type']) && $definition['type'] === 'hacked_project');
31   }
32
33 }