Is it possible to specify code style settings for inline PHP or PHTML files?
Hello,
I've tried to look in the forum for a similar question but no luck so far.
I'm looking for a way to specify code style (indentation, new line policy, etc) settings for PHTML files or HTML with inline PHP code.
Let's say I have the following piece of code:
<?php if ($this->canEmailToFriend()): ?>
<p >
<a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend') ?></a>
</p>
<?php endif; ?>`
If I use PHPStorms "Reformat Code" option on the whole file, the text gets reformatted to this:
<?php if ($this->canEmailToFriend()): ?> <p > <a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend') ?></a> </p> <?php endif; ?>
Is there a way to change how PHPStorm applies code style settings on files with inline PHP code?
Thank you.
Please sign in to leave a comment.
What is your PhpStorm version? In the latest EAP build (that includes bugfix of the issue WI-11118) I get the following result:
<?php if ($this->canEmailToFriend()): ?> <p > <a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend') ?></a> </p> <?php endif; ?>Is this what you need?
That's exactly what I need. Thank you.
PS: not running latest EAP, will check that.