I noticed a very strange behavior in my extension
When I install my extension, I noticed that some "str_replace" functions do not work with the "before" handler. But when I upload the corresponding controller file via FTP, everything works again!
Looking deeper into the code, I noticed that it is only the functions where I try to replace special code with "str_replace".
This works for example:I think it is due to the indentation of the code which is lost during the regular installation and takes effect again during the transfer via FTP.
Code: Select all
$output = str_replace('</a></h4>', 'REPLACE WITH SOMETHING', $output);
This example code does not work at first after installation, only when I transfer it via FTP:
Code: Select all
$output = str_replace('{% if review_status %}
<li class="nav-item"><a href="#tab-review" data-bs-toggle="tab" class="nav-link">{{ tab_review }}</a></li>
{% endif %}', 'REPLACE WITH SOMETHING', $output);
Best,
Jack