Skip to content

Commit

Permalink
bugfix on backend rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
markusmilkereit committed Jan 15, 2022
1 parent 62d4aa5 commit a3bb43f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# contao-inserttags
New, clean insert tag handling, adding some custom logic to existing insert tags in Contao 4.
New, clean insert tag handling, adding some custom logic to existing insert tags in Contao 4.x

Also activates rendering of insert tags in the backend - especially nice for custom elements, included subtemplates, icons and many more tricks in content element organisation.

Does not replace it on any kind of backend action that depends on insert tags, and we're not touching the HTML element - that usually is modules or other "bigger" includes.

###New tags

Expand Down
9 changes: 6 additions & 3 deletions src/EventListener/ParseBackendTemplateListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ class ParseBackendTemplateListener
public function __invoke(string $buffer, string $template): string
{
if ('be_main' === $template) {
// modify only if we're not in any action mode
// modify only if we're not in any action mode, popup or dynamic context
// modify only if there is no HTML content element involved
if(!Input::get('act')
if(
!Input::get('act')
AND !Input::get('context')
AND !Input::get('picker')
AND strpos($buffer, '<div class="cte_type published">HTML</div>') === false
AND strpos($buffer, '<div class="cte_type unpublished">HTML</div>') === false
){
){
$objIt = new InsertTags();
$buffer = $objIt->replace($buffer, true);
}
Expand Down

0 comments on commit a3bb43f

Please sign in to comment.