TypeError when exporting Canvas pages with block components in DefaultContentSubscriber
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3569620. -->
Reported by: [rajab natshah](https://www.drupal.org/user/1414312)
Related to !508
>>>
<h3 id="overview">Overview</h3>
<p>When attempting to export canvas page entities that contain block components (e.g., <code>block.webform_block</code>) using the <code>drush content:export</code> command, a TypeError is thrown:</p>
<pre> TypeError: Drupal\canvas\PropSource\PropSource::parse(): Argument #1 () must be of type array, string given, called in /var/www/html/web/modules/contrib/canvas/src/EventSubscriber/DefaultContentSubscriber.php on line 81</pre><p>The issue occurs in the <code>DefaultContentSubscriber::preExport()</code> method when it attempts to parse all inputs from <code>getDefaultExplicitInput()</code> as PropSource arrays. However, block components return simple configuration values (strings, booleans, integers) from their <code>defaultConfiguration()</code> method, not PropSource arrays.</p>
<h3>Steps to reproduce</h3>
<ol>
<li>Create a canvas page entity with a block component (e.g., webform block)</li>
<li>Run: <code>drush content:export canvas_page [ID] --dir=/path/to/export</code></li>
<li>Observe the TypeError</li>
</ol>
<h3 id="proposed-resolution">Proposed resolution</h3>
<p>Add validation in <code>DefaultContentSubscriber.php</code> to check if the input is an array with a <code>sourceType</code> key before attempting to parse it as a PropSource. Block plugin configuration values should be skipped since they don't contain entity references that need UUID conversion.</p>
<pre> foreach ($inputs as $prop_name => $input) {<br> // Skip inputs that are not arrays or don't have a sourceType.<br> // This can happen with block components that have simple configuration values.<br> if (!is_array($input) || !isset($input['sourceType'])) {<br> continue;<br> }<br> $prop_source = PropSource::parse($input);<br> // ... rest of the code<br> }</pre><h3 id="ui-changes">User interface changes</h3>
issue