Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added MenuDefault annotation

  • Loading branch information...
commit c9ab642eed696f6c8c804c8e588227819cfa2ba5 1 parent 872909b
Sergey Yuferev authored
Showing with 32 additions and 1 deletion.
  1. +30 −0 Annotation/MenuDefault.php
  2. +2 −1  Config/OptionMerger.php
View
30 Annotation/MenuDefault.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Millwright\MenuBundle\Annotation;
+
+/**
+ * Represents a @Translate annotation.
+ *
+ * @Annotation
+ * @Target("CLASS")
+ * @author Stefan Zerkalica <zerkalica@gmail.com>
+ */
+final class MenuDefault
+{
+ public $translateDomain;
+ public $translateParameters;
+
+ public $showNonAuthorized;
+ public $showAsText;
+
+ public function __construct(array $values)
+ {
+ foreach($values as $property => $value) {
+ $this->$property = $value;
+ }
+
+ if ($this->translateParameters) {
+ $this->translateParameters = array_map('trim', explode(',', $this->translateParameters));
+ }
+ }
+}
View
3  Config/OptionMerger.php
@@ -15,6 +15,7 @@
use JMS\SecurityExtraBundle\Annotation\SecureParam;
use JMS\SecurityExtraBundle\Annotation\Secure;
use Millwright\MenuBundle\Annotation\Menu;
+use Millwright\MenuBundle\Annotation\MenuDefault;
/**
* @author Stefan Zerkalica <zerkalica@gmail.com>
@@ -114,7 +115,7 @@ protected function getAnnotations(array $annotations,
$argument = $arguments[$param->name];
$class = $argument->getClass();
$options['secureParams'][$param->name]['class'] = $class->getName();
- } else if ($param instanceof Secure || $param instanceof Menu ) {
+ } else if ($param instanceof Secure || $param instanceof Menu || $param instanceof MenuDefault) {
$options += $this->annotationToArray($param);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.