MishkaCmsMigration.Targets.Helpers.Widgets (Mishka CMS Migration v0.0.1)

Copy Markdown View Source

The widgets of a page builder an item was laid out with that the CMS has no equivalent for, such as an Elementor form, slider or map, for the targets that write the content (MishkaCmsMigration.Targets.CmsPage, MishkaCmsMigration.Targets.BlogPost). The source names them in the item's "unsupported_widgets", and puts what the builder drew for each in its place in the content, its fallback HTML (MishkaCmsMigration.Sources.WordPress.Elementor).

Such an item is never written on its own: it waits for an admin's decision (MishkaCmsMigration.MigrationItem's Decide…) on "unsupported_widgets", its reason naming the widgets after ": " ("unsupported_widgets: form, slides"), in the dry run (the target's waiting/2, waiting/2 here) and in prepare/3 for any write (call/2). Import with the fallback HTML for those parts ("import") writes it with that HTML, and the report names them ("fallback_html: <names>", note/2), and those the builder drew nothing for, which have no fallback ("no_fallback: <names>"); Leave the page out leaves the item out, as Leave out does.

Summary

Functions

:ok for item to be written: it has no such widgets, or an admin decided to import it with their fallback HTML; else {:undecided, conflict}.

The conflict item waits on: "unsupported_widgets: <names>" for an item laid out with widgets the CMS has no equivalent for, else nil.

What the report says of item's widgets once it is written: "fallback_html: <names>" for those written with what the builder drew for them, and "no_fallback: <names>" for those it drew nothing for (the source's "no_fallback_widgets"), joined by "; ", else nil.

What the target's waiting/2 says of item: {:undecided, conflict} until an admin decides to import it with the fallback HTML, then nil, to be written, as for an item with no such widgets.

Functions

call(item, context)

:ok for item to be written: it has no such widgets, or an admin decided to import it with their fallback HTML; else {:undecided, conflict}.

conflict(item)

@spec conflict(MishkaCmsMigration.Source.Item.t()) :: String.t() | nil

The conflict item waits on: "unsupported_widgets: <names>" for an item laid out with widgets the CMS has no equivalent for, else nil.

note(item, context)

What the report says of item's widgets once it is written: "fallback_html: <names>" for those written with what the builder drew for them, and "no_fallback: <names>" for those it drew nothing for (the source's "no_fallback_widgets"), joined by "; ", else nil.

waiting(item, context)

What the target's waiting/2 says of item: {:undecided, conflict} until an admin decides to import it with the fallback HTML, then nil, to be written, as for an item with no such widgets.