В моем приложении Laravel 7.6 / blade / bootstrap 4 / flex у меня есть страница, где блоки данных отображаются в 2 столбца на большом устройстве и в 1 столбце на маленьком устройстве, что реализовано с помощью классов block_2columns_md / block_splitting_left_half / block_splitting_right_half, и он работает так, как я ожидал:
@extends($frontend_template_name.'.layouts.frontend')
@section('content')
@inject('viewFuncs', 'App\library\viewFuncs')
<article class="fill-area-content flexbox-item-grow page_content_container">
<div class="column_content_left_aligned m-0 ml-3">
{{ Breadcrumbs::render('home') }}
</div>
<div class="block_2columns_md m-0 p-1 page_content">
<div class="block_splitting_left_23 m-0 p-3">
@if( count($activeQuizVotes) > 0 )
<div class="column_content_centered bordered">
<h3 class="text-center">
Quizzes
</h3>
<div class=" bordered">
<?php $odd = true; $index = 1;?>
@foreach($activeQuizVotes as $nextActiveQuizVote)
@if($odd)
<div class="block_2columns_md m-0 p-1">
@endif
<div class="@if($odd) block_splitting_left_half m-0 p-3 @else block_splitting_right_half m-0 p-3 @endif vote-item-wrapper">
<div class="card ">
<div class="card-body">
<span class="w-80 mx-auto px-4 py-1 rounded-bottom category-link primary border-info text-white">
@if(!empty($nextActiveQuizVote->vote_category_name) )
<a href="{{ route('votes-by-category', $nextActiveQuizVote->vote_category_slug ) }}">
<strong>{{$nextActiveQuizVote->vote_category_name }} </strong>
</a>
@endif
</span>
<div class="img-preview-wrapper">
<?php $voteImagePropsAttribute = $nextActiveQuizVote->getVoteImagePropsAttribute();?>
@if(isset($voteImagePropsAttribute['image_url']) )
<a href="{{ route('vote_by_slug', $nextActiveQuizVote->slug ) }}">
<img class="card-img-top image_in_3_columns_list"
src="{{ $voteImagePropsAttribute['image_url'] }}{{ "?dt=".time() }}"
alt="{{ $nextActiveQuizVote->name }}">
</a>
@endif
</div>
<h5 class="card-title">
<a href="{{ route('vote_by_slug', $nextActiveQuizVote->slug ) }}">
{{ $nextActiveQuizVote->name }}
</a>
</h5>
<p class="card-text">{!! Purifier::clean(concatStr($nextActiveQuizVote->description,100)) !!}</p>
<a href="{{ route('vote_by_slug', $nextActiveQuizVote->slug ) }}">
Go to Quiz
</a>
</div> <!-- <div class="card-body"> -->
</div> <!-- <div class="card "> -->
</div> <!-- block_splitting_left_half / block_splitting_right_half -->
@if(!$odd)
</div> <!-- <div class="block_2columns_md m-0 p-1"> -->
@endif
<?php $odd = ! $odd; $index++; ?>
@endforeach
</div>
<div class="column_content_centered bordered">
{{ $activeQuizVotes->appends([])->links() }}
</div>
<div class="column_content_centered bordered">
{{ Widget::run('LatestNews', [
'items_per_block' => 4,
'filter_published'=> 1,
'filter_is_homepage'=>1
]) }}
</div>
<div class="column_content_centered bordered">
{{ Widget::run('LatestExternalNews', [
'items_per_block' => 10,
'filter_published'=> 1,
'filter_is_homepage'=>1
]) }}
</div>
</div>
@endif {{-- @if( count($activeQuizVotes) > 0 )--}}
</div> <!-- <div class="block_splitting_left_23 m-0 p-3"> -->
<div class="block_splitting_right_13 m-0 p-3">
@include($frontend_template_name.'.layouts.right_menu_block' , [ 'show_questions_block' => true, 'show_most_rated_quizzes_block' => true,
'show_most_taggable_votes_block' => true, 'show_vote_categories_block'=> true ] )
</div>{{--<div class="block_splitting_right_13" >--}}
</div> {{--<div class="block_2columns_md">--}}
</article>
@endsection
В моем макете у меня есть форматирование ключевых блоков:
@if($odd)
<div class="block_2columns_md m-0 p-1">
@endif
...
@if(!$odd)
</div> <!-- <div class="block_2columns_md m-0 p-1"> -->
@endif
Но когда в моем PhpStorm 2019.2.3 я выбираю все содержимое редактора и запустите функцию «Переформатировать код». У меня неверный формат текста:
@extends($frontend_template_name.'.layouts.frontend')
@section('content')
@inject('viewFuncs', 'App\library\viewFuncs')
<article class="fill-area-content flexbox-item-grow page_content_container">
<div class="column_content_left_aligned m-0 ml-3">
{{ Breadcrumbs::render('home') }}
</div>
<div class="block_2columns_md m-0 p-1 page_content">
<div class="block_splitting_left_23 m-0 p-3">
@if( count($activeQuizVotes) > 0 )
<div class="column_content_centered bordered">
<h3 class="text-center">
Quizzes
</h3>
<div class=" bordered">
<?php $odd = true; $index = 1;?>
@foreach($activeQuizVotes as $nextActiveQuizVote)
@if($odd)
<div class="block_2columns_md m-0 p-1">
@endif
<div class="@if($odd) block_splitting_left_half m-0 p-3 @else block_splitting_right_half m-0 p-3 @endif vote-item-wrapper">
<div class="card ">
<div class="card-body">
<span class="w-80 mx-auto px-4 py-1 rounded-bottom category-link primary border-info text-white">
@if(!empty($nextActiveQuizVote->vote_category_name) )
<a href="{{ route('votes-by-category', $nextActiveQuizVote->vote_category_slug ) }}">
<strong>{{$nextActiveQuizVote->vote_category_name }} </strong>
</a>
@endif
</span>
<div class="img-preview-wrapper">
<?php $voteImagePropsAttribute = $nextActiveQuizVote->getVoteImagePropsAttribute();?>
@if(isset($voteImagePropsAttribute['image_url']) )
<a href="{{ route('vote_by_slug', $nextActiveQuizVote->slug ) }}">
<img class="card-img-top image_in_3_columns_list"
src="{{ $voteImagePropsAttribute['image_url'] }}{{ "?dt=".time() }}"
alt="{{ $nextActiveQuizVote->name }}">
</a>
@endif
</div>
<h5 class="card-title">
<a href="{{ route('vote_by_slug', $nextActiveQuizVote->slug ) }}">
{{ $nextActiveQuizVote->name }}
</a>
</h5>
<p class="card-text">{!! Purifier::clean(concatStr($nextActiveQuizVote->description,100)) !!}</p>
<a href="{{ route('vote_by_slug', $nextActiveQuizVote->slug ) }}">
Go to Quiz
</a>
</div> <!-- <div class="card-body"> -->
</div> <!-- <div class="card "> -->
</div> <!-- block_splitting_left_half / block_splitting_right_half -->
@if(!$odd)
</div> <!-- <div class="block_2columns_md m-0 p-1"> -->
@endif
<?php $odd = ! $odd; $index++; ?>
@endforeach
</div>
<div class="column_content_centered bordered">
{{ $activeQuizVotes->appends([])->links() }}
</div>
<div class="column_content_centered bordered">
{{ Widget::run('LatestNews', [
'items_per_block' => 4,
'filter_published'=> 1,
'filter_is_homepage'=>1
]) }}
</div>
<div class="column_content_centered bordered">
{{ Widget::run('LatestExternalNews', [
'items_per_block' => 10,
'filter_published'=> 1,
'filter_is_homepage'=>1
]) }}
</div>
</div>
@endif {{-- @if( count($activeQuizVotes) > 0 )--}}
</div> <!-- <div class="block_splitting_left_23 m-0 p-3"> -->
<div class="block_splitting_right_13 m-0 p-3">
@include($frontend_template_name.'.layouts.right_menu_block' , [ 'show_questions_block' => true, 'show_most_rated_quizzes_block' => true,
'show_most_taggable_votes_block' => true, 'show_vote_categories_block'=> true ] )
</div>{{--<div class="block_splitting_right_13" >--}}
</div> {{--<div class="block_2columns_md">--}}
</article>
@endsection
С недопустимыми ключевыми блоками:
@if($odd)
<div class="block_2columns_md m-0 p-1">
@endif
@if(!$odd)
</div> <!-- <div class="block_2columns_md m-0 p-1"> -->
@endif
Почему такое неправильное форматирование и как исправить это?
Спасибо!