<p>Since it appears that you are using Craft CMS 3, you can try the <a href="https://docs.craftcms.com/v3/dev/filters.html#purify" rel="nofollow noreferrer"><code>purify</code></a> filter. </p>

<p>In your code, change this line:</p>

<pre><code>{% set vidcode = embed.isSafe() | trim('&lt;iframe') %}
</code></pre>

<p>To something like:</p>

<pre><code>{% set vidcode = embed | purify | trim('&lt;iframe') %}
</code></pre>

<p>Documentation: </p>

CC BY-SA 4.0
2020-03-17T23:43:09.667Z
2020-03-17T23:43:09.667Z
Tammy Shipps
<p>I'm getting a Deprecated Warning on the property safeHtml:</p>

<blockquote>
  <p>The embedded asset property <code>safeHtml</code> is now deprecated. Use a
  combination of the <code>isSafe()</code> method and the <code>code</code> property instead.</p>
</blockquote>

<p>This is picked up on line 4 and 11 of the code below:</p>

<pre><code>        {# if video embed #}
        {% if embed.type == 'video' %}
            &lt;div class="aspect-ratio aspect-ratio--16x9"&gt;
                {% set vidcode = embed.isSafe() | trim('&lt;iframe') %}
                {% set vid = '&lt;iframe class="aspect-ratio--object" ' ~ vidcode %}
                {{ vid|raw }}
            &lt;/div&gt;
        {# else if rich embed #}
        {% else %}
            &lt;div class="w-100 w-75-ns center"&gt;
                {{ embed.isSafe()|raw }}
            &lt;/div&gt;
        {% endif %}
</code></pre>

<p>How do I update this code correctly to remove the warning?</p>

<craft3><plugin-embeddedassets>
Deprecated Warning: safeHtml
# Deprecated Warning: safeHtml

(Asked by: username_0 on 2019-10-15)

I'm getting a Deprecated Warning on the property safeHtml:

The embedded asset property safeHtml is now deprecated. Use a
  combination of the isSafe() method and the code property instead.

This is picked up on line 4 and 11 of the code below:
        {# if video embed #}
        {% if embed.type == 'video' %}
            
                {% set vidcode = embed.isSafe() | trim('
        {# else if rich embed #}
        {% else %}
            
                {{ embed.isSafe()|raw }}
            
        {% endif %}

How do I update this code correctly to remove the warning?

**Tags:** craft3, plugin-embeddedassets


---

## 1 answers

### Answer by username_1 on 2020-03-17. Score: 1

Since it appears that you are using Craft CMS 3, you can try the purify filter. 
In your code, change this line:
{% set vidcode = embed.isSafe() | trim('
To something like:
{% set vidcode = embed | purify | trim('
Documentation:


---

