Don't save empty attributes
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3214676. -->
Reported by: [andypost](https://www.drupal.org/user/118908)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p> Follow-up to <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/menu_link_attributes/-/work_items/3199781" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/menu_link_attributes/-/work_items/3199781</a></span></p>
<p>Empty attributes (class for example still saved into database)</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<pre>select * from menu_link_content_data<br><br>| id | revision_id | bundle | langcode | enabled | title | description | menu_name | link__uri | link__title | link__options | external | rediscover | weight | expanded | parent | changed | default_langcode | revision_translation_affected |<br>+----+-------------+-------------------+----------+---------+-----------------------+-------------+-----------+--------------------------------------+-------------+--------------------------------------------------------------------------------------+----------+------------+--------+----------+--------+------------+------------------+-------------------------------+<br>| 1 | 1 | menu_link_content | en | 1 | Test page | NULL | footer | internal:/test-page | | a:1:{s:10:"attributes";a:2:{s:5:"class";a:1:{i:0;s:0:"";}s:3:"rel";s:8:"nofollow";}} | 0 | 1 | -50 | 0 | NULL | 1621397169 | 1 | 1 |</pre><h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Clean-up array attributes properly</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>review/commit</p>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>no</p>
<h3 id="summary-api-changes">API changes</h3>
<p>no</p>
<h3 id="summary-data-model-changes">Data model changes</h3>
<p>no</p>
issue