cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,45 +1,33 @@
<?php
/*
/**
* Chill is a software for social workers
*
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldInterface;
use Chill\CustomFieldsBundle\Entity\CustomField;
use Chill\CustomFieldsBundle\Form\Type\CustomFieldsTitleType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Bundle\TwigBundle\TwigEngine;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Bundle\TwigBundle\TwigEngine;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chill\CustomFieldsBundle\Form\Type\CustomFieldsTitleType;
class CustomFieldTitle extends AbstractCustomField
{
const TYPE = 'type';
const TYPE_TITLE = 'title';
const TYPE_SUBTITLE = 'subtitle';
public const TYPE = 'type';
public const TYPE_SUBTITLE = 'subtitle';
public const TYPE_TITLE = 'title';
private $requestStack;
/**
*
* @var TwigEngine
*/
private $templating;
@@ -49,8 +37,11 @@ class CustomFieldTitle extends AbstractCustomField
*/
private $translatableStringHelper;
public function __construct(RequestStack $requestStack, TwigEngine $templating,
TranslatableStringHelper $translatableStringHelper)
public function __construct(
RequestStack $requestStack,
TwigEngine $templating,
TranslatableStringHelper $translatableStringHelper
)
{
$this->requestStack = $requestStack;
$this->templating = $templating;
@@ -59,30 +50,29 @@ class CustomFieldTitle extends AbstractCustomField
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
{
$builder->add($customField->getSlug(), CustomFieldsTitleType::class, array(
$builder->add($customField->getSlug(), CustomFieldsTitleType::class, [
'label' => false,
'attr' => array(
'attr' => [
'class' => 'cf-title',
'title' => $this->translatableStringHelper->localize($customField->getName()),
self::TYPE => $customField->getOptions()[self::TYPE ]
)
));
self::TYPE => $customField->getOptions()[self::TYPE],
],
]);
}
public function render($value, CustomField $customField, $documentType = 'html')
public function buildOptionsForm(FormBuilderInterface $builder)
{
return $this->templating
->render('ChillCustomFieldsBundle:CustomFieldsRendering:title.html.twig',
array(
'title' => $customField->getName(),
'type' => $customField->getOptions()[self::TYPE]
)
);
}
public function serialize($value, CustomField $customField)
{
return $value;
return $builder->add(
self::TYPE,
ChoiceType::class,
[
'choices' => [
'Main title' => self::TYPE_TITLE,
'Subtitle' => self::TYPE_SUBTITLE,
],
'label' => 'Title level',
]
);
}
public function deserialize($serialized, CustomField $customField)
@@ -100,16 +90,20 @@ class CustomFieldTitle extends AbstractCustomField
return false;
}
public function buildOptionsForm(FormBuilderInterface $builder)
public function render($value, CustomField $customField, $documentType = 'html')
{
return $builder->add(self::TYPE, ChoiceType::class,
array(
'choices' => array(
'Main title' => self::TYPE_TITLE,
'Subtitle' => self::TYPE_SUBTITLE
),
'label' => 'Title level',
)
);
return $this->templating
->render(
'ChillCustomFieldsBundle:CustomFieldsRendering:title.html.twig',
[
'title' => $customField->getName(),
'type' => $customField->getOptions()[self::TYPE],
]
);
}
public function serialize($value, CustomField $customField)
{
return $value;
}
}