backports murph-skeleton
This commit is contained in:
parent
af4dbaa570
commit
3965aaadda
|
@ -44,6 +44,11 @@ class Node implements EntityInterface
|
||||||
*/
|
*/
|
||||||
private $url;
|
private $url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean", options={"default"=0})
|
||||||
|
*/
|
||||||
|
private $disableUrl = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="boolean", options={"default"=0})
|
* @ORM\Column(type="boolean", options={"default"=0})
|
||||||
*/
|
*/
|
||||||
|
@ -298,6 +303,18 @@ class Node implements EntityInterface
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDisableUrl(): ?bool
|
||||||
|
{
|
||||||
|
return $this->disableUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDisableUrl(bool $disableUrl): self
|
||||||
|
{
|
||||||
|
$this->disableUrl = $disableUrl;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getTreeLabel()
|
public function getTreeLabel()
|
||||||
{
|
{
|
||||||
$prefix = str_repeat('-', ($this->getTreeLevel() - 1) * 5);
|
$prefix = str_repeat('-', ($this->getTreeLevel() - 1) * 5);
|
||||||
|
|
|
@ -60,6 +60,12 @@ class NodeEventSubscriber extends EntityManagerEventSubscriber
|
||||||
|
|
||||||
$node->setCode($this->codeSlugify->slugify($node->getCode()));
|
$node->setCode($this->codeSlugify->slugify($node->getCode()));
|
||||||
|
|
||||||
|
if ($node->getDisableUrl()) {
|
||||||
|
$node->setUrl(null);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($node->getUrl()) {
|
if ($node->getUrl()) {
|
||||||
$generatedUrl = $node->getUrl();
|
$generatedUrl = $node->getUrl();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -13,6 +13,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
|
||||||
class NodeType extends AbstractType
|
class NodeType extends AbstractType
|
||||||
{
|
{
|
||||||
|
@ -46,6 +47,19 @@ class NodeType extends AbstractType
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$builder->add(
|
||||||
|
'disableUrl',
|
||||||
|
CheckboxType::class,
|
||||||
|
[
|
||||||
|
'label' => 'Disable URL',
|
||||||
|
'required' => false,
|
||||||
|
'attr' => [
|
||||||
|
],
|
||||||
|
'constraints' => [
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$builder->add(
|
$builder->add(
|
||||||
'code',
|
'code',
|
||||||
TextType::class,
|
TextType::class,
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
"Yearly": "Annuelle"
|
"Yearly": "Annuelle"
|
||||||
"Never": "Jamais"
|
"Never": "Jamais"
|
||||||
"URL": "URL"
|
"URL": "URL"
|
||||||
|
"Disable URL": "Désactiver l'URL"
|
||||||
"Controller": "Contrôleur"
|
"Controller": "Contrôleur"
|
||||||
"Leave blank for automatic generation": "Laisser vide pour une génération automatique"
|
"Leave blank for automatic generation": "Laisser vide pour une génération automatique"
|
||||||
"Leave blank to use the default one. Example: App\\Controller\\FooController::barAction": "Laisser vide pour utiliser celui par défaut. Exemple : App\\Controller\\FooController::barAction"
|
"Leave blank to use the default one. Example: App\\Controller\\FooController::barAction": "Laisser vide pour utiliser celui par défaut. Exemple : App\\Controller\\FooController::barAction"
|
||||||
|
|
|
@ -144,6 +144,7 @@
|
||||||
{{ 'Route name: <code>%routeName%</code>'|trans({'%routeName%': entity.routeName})|raw }}
|
{{ 'Route name: <code>%routeName%</code>'|trans({'%routeName%': entity.routeName})|raw }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ form_row(form.disableUrl) }}
|
||||||
{{ form_row(form.code) }}
|
{{ form_row(form.code) }}
|
||||||
{{ form_row(form.controller) }}
|
{{ form_row(form.controller) }}
|
||||||
|
|
||||||
|
|
|
@ -84,23 +84,25 @@
|
||||||
<span class="fa fa-sign-out-alt text-muted"></span>
|
<span class="fa fa-sign-out-alt text-muted"></span>
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if node.parameters|length %}
|
{% if not node.disableUrl %}
|
||||||
<span class="btn btn-sm border border-secondary btn-light">
|
{% if node.parameters|length %}
|
||||||
{{ node.url }}
|
<span class="btn btn-sm border border-secondary btn-light">
|
||||||
</span>
|
|
||||||
{% else %}
|
|
||||||
{% set url = safe_node_url(node) %}
|
|
||||||
|
|
||||||
{% if url %}
|
|
||||||
<a href="{{ url ? url : '#' }}" target="_blank" class="btn btn-sm border border-secondary btn-light">
|
|
||||||
{{ node.url }}
|
{{ node.url }}
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if url is same as(null) %}
|
|
||||||
<span class="btn btn-sm border border-secondary btn-light" title="{{ 'Edit the routing'|trans }}">
|
|
||||||
<span class="fa fa-exclamation"></span>
|
|
||||||
</span>
|
</span>
|
||||||
|
{% else %}
|
||||||
|
{% set url = safe_node_url(node) %}
|
||||||
|
|
||||||
|
{% if url %}
|
||||||
|
<a href="{{ url ? url : '#' }}" target="_blank" class="btn btn-sm border border-secondary btn-light">
|
||||||
|
{{ node.url }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if url is same as(null) %}
|
||||||
|
<span class="btn btn-sm border border-secondary btn-light" title="{{ 'Edit the routing'|trans }}">
|
||||||
|
<span class="fa fa-exclamation"></span>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue