Reputation: 3071
In my Laravel 7.6 / blade / bootstrap 4 / flex app I have a page where blocks of data which are shown in 2 columns on big device and in 1 column on small device, what is implemented with classes block_2columns_md/block_splitting_left_half/block_splitting_right_half and it works as I expected :
@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
In my layout I have key blocks formatting:
@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
But when in my PhpStorm 2019.2.3 I select all content of the editor and run function “Reformat Code” I have invalid text formatted :
@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
With invalid key blocks :
@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
Why so wrong formatting and in which way can I fix it ?
Thanks!
Upvotes: 0
Views: 460
Reputation: 3043
It's a bug that is not yet resolved, please vote: https://youtrack.jetbrains.com/issue/WI-48192
Upvotes: 2