migrate_visualize-1.0.x-dev/templates/migration-visualize-mermaid.html.twig
templates/migration-visualize-mermaid.html.twig
{#
/**
* @file
* Render a Migration as a MermaidJS chart.
*
* Available variables:
* - migration: The migration to render
* - source: Array of source fields
* - destination: Array of destination fields
* - process: Array of source to destination mappings
*
* @see template_preprocess_mermaid_visualize()
*
* @ingroup themeable
*/
#}
<h1>{{ migration.label() }}</h1>
{% for tag in ['display', 'source'] %}
{% if tag == "display"%}
<div class="migration-display mermaid">
{% elseif tag == "source" %}
<div class="migration-source"><textarea rows="80">
{% endif %}
---
# Generated with Migrate Visualize
# https://drupal.org/project/migrate_visualize
---
flowchart LR
subgraph Source[fa:fa-cloud-download Source]
{% for vertex in graph.getVertices() %}
{% if vertex.getAttribute('migrate_visualize.group') == 'source' %}
{{ vertex.getId() }}["{{ vertex.getAttribute('migrate_visualize.label') }}"]
{% endif %}
{% endfor %}
end
subgraph Destination[fa:fa-cloud-upload Destination]
{% for vertex in graph.getVertices() %}
{% if vertex.getAttribute('migrate_visualize.group') == 'destination' %}
{{ vertex.getId() }}["{{ vertex.getAttribute('migrate_visualize.label') }}"]
{% endif %}
{% endfor %}
end
subgraph Process[fa:fa-cloud-upload Process]
{% for vertex in graph.getVertices() %}
{% if vertex.getAttribute('migrate_visualize.group') == 'process' %}
{{ vertex.getId() }}["{{ vertex.getAttribute('migrate_visualize.label') }}"]
{% endif %}
{% endfor %}
end
{% for edge in graph.getEdges() %}
{% if edge.getAttribute('migrate_visualize.type') != 'pseudofield' %}
{{ edge.getVertexStart().getId() }} --> {{ edge.getVertexEnd().getId() }}
{% endif %}
{% endfor %}
{% for edge in graph.getEdges() %}
{% if edge.getAttribute('migrate_visualize.type') == 'pseudofield' %}
{{ edge.getVertexStart().getId() }} --> {{ edge.getVertexEnd().getId() }}
{% endif %}
{% endfor %}
{% if tag == "display" %}
</div>
{% elseif tag == "source" %}
</textarea>
<div class="copy-source">Copy source</div>
</div>
{% endif %}
{% endfor %}
