Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-17T23:43:09.667Z
Answers.LastActivityDate: 2020-03-17T23:43:09.667Z
Answers.UserDisplayName: Tammy Shipps
Body: <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>
  
Tags: <craft3><plugin-embeddedassets>
Title: Deprecated Warning: safeHtml
ThreadText: # 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' %}
              <div class="aspect-ratio aspect-ratio--16x9">
                  {% set vidcode = embed.isSafe() | trim('<iframe') %}
                  {% set vid = '<iframe class="aspect-ratio--object" ' ~ vidcode %}
                  {{ vid|raw }}
              </div>
          {# else if rich embed #}
          {% else %}
              <div class="w-100 w-75-ns center">
                  {{ embed.isSafe()|raw }}
              </div>
          {% 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`](https://docs.craftcms.com/v3/dev/filters.html#purify) filter.
  
  In your code, change this line:
  
  ```
  {% set vidcode = embed.isSafe() | trim('<iframe') %}
  
  ```
  
  To something like:
  
  ```
  {% set vidcode = embed | purify | trim('<iframe') %}
  
  ```
  
  Documentation:
  
  
  ---
  
  