How to format long lines in Twig templates according to coding standards?

I have the following code in my templates in which I generate routes with parameters:

<a class="btn btn-block btn-abcd" href="{{ path(
    'auth.login',
    {
        'type': constant('User::TYPE_CANDIDATE'),
        'provider': constant('UserProvider::PROVIDER_XING')
    }
) }}">...</a>

I split it into lines the way I did with PHP code. I'm just not sure if this is the recommended practice or not. The coding standards page on the Twig site does not address this specific issue.

+4
source share
2 answers

, , , , //. , .

:

<a class="btn btn-block btn-abcd"
    href="{{ path(
        'auth.login', {
            'type': constant('User::TYPE_CANDIDATE'),
            'provider': constant('UserProvider::PROVIDER_XING')
        }
    ) }}">
    Link text
</a>

, 50 .

+1

PHP, , - Twig, {{ {%, <?php.

, , : https://github.com/cybtachyon/twig-standards.

Alec, Twig.

<a class="btn btn-block btn-abcd" href="{{
  path(
    'auth.login',
    {
      'type': constant('User::TYPE_CANDIDATE'),
      'provider': constant('UserProvider::PROVIDER_XING'),
    }
  )
  }}">
    Link text
</a>
0

All Articles