04.07.2019 Views

frontend-developer-1

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Create and Customize Template Files<br />

<br />

The value for test_value will be available in the template like: $block-<br />

>getData('test_value') or $block->getTestValue().<br />

HELPFUL LINKS:<br />

• https://alanstorm.com/magento_2_javascript_css_layout_woes/<br />

4.5 DEMONSTRATE ABILITY TO ESCAPE<br />

CONTENT RENDERED AND TEMPLATE FILES<br />

How can dynamic values be rendered securely in HTML, HTML<br />

attributes, JavaScript, and in URLs?<br />

This is possible by utilizing the block’s built-in methods.<br />

• HTML: $block->escapeHtml('value', $allowedTags);<br />

• HTML attributes: $block->escapeHtmlAttr('value',<br />

$escapeSingleQuote);<br />

• JavaScript: $block->escapeJs('value');<br />

• URLs: $block->escapeUrl($url);<br />

Copyright © 2018, SwiftOtter, Inc.<br />

55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!