'metaTemplates', 'action' => 'view', $newestMetaTemplate->id ]); $bodyHtml = ''; $bodyHtml .= sprintf('
%s: %s
', __('Current version'), h($oldMetaTemplate->version)); $bodyHtml .= sprintf('
%s: %s
', __('Newest version'), $urlNewestMetaTemplate, h($newestMetaTemplate->version)); $bodyHtml .= sprintf('

%s

', __('{0} Entities with meta-fields for the meta-template version {1}', h($entityCount), h($oldMetaTemplate->version))); if (empty($conflictingEntities)) { $bodyHtml .= $this->Bootstrap->alert([ 'text' => __('All entities can updated automatically', count($conflictingEntities)), 'variant' => 'success', 'dismissible' => false, ]); } else { $bodyHtml .= $this->Bootstrap->alert([ 'html' => sprintf( '', $this->Bootstrap->node('li', [], __('{0} entities can be updated automatically', $entityCount - count($conflictingEntities))), $this->Bootstrap->node('li', [], __('{0} entities cannot be updated automatically and require manual migration', count($conflictingEntities))) ), 'variant' => 'warning', 'dismissible' => false, ]); $bodyHtml .= ''; } $form = sprintf( '
%s%s
', $this->Form->create(null, [ 'url' => [ 'controller' => 'MetaTemplates', 'action' => 'migrateMetafieldsToNewestTemplate', $oldMetaTemplate->id, ] ]), $this->Form->end() ); $bodyHtml .= $form; $form = sprintf( '
%s%s
', $this->Form->create(null, [ 'url' => [ 'controller' => 'MetaTemplates', 'action' => 'migrateMetafieldsToNewestTemplate', $oldMetaTemplate->id, 1, ] ]), $this->Form->end() ); $bodyHtml .= $form; $title = __('{0} has a new meta-template and meta-fields to be updated', sprintf('%s', h($oldMetaTemplate->name))); if (!empty($ajax)) { echo $this->Bootstrap->modal([ 'titleHtml' => $title, 'bodyHtml' => $bodyHtml, 'size' => 'lg', 'type' => 'custom', 'footerButtons' => [ [ 'text' => __('Cancel'), 'variant' => 'secondary', ], [ 'text' => __('Force Migrate meta-fields'), 'title' => __('Any meta-field having conflict will be deleted.'), 'variant' => 'danger', 'clickFunction' => 'forceMigrateMetafieldsToNewestTemplate', ], [ 'text' => __('Migrate meta-fields'), 'variant' => 'success', 'clickFunction' => 'migrateMetafieldsToNewestTemplate', ], ], ]); } else { echo $this->Bootstrap->node('h1', [], $title); echo $bodyHtml; echo $this->Bootstrap->button([ 'text' => __('Force Migrate meta-fields'), 'title' => __('Any meta-field having conflict will be deleted.'), 'variant' => 'danger', 'class' => ['me-2'], 'onclick' => '$(".hidden-form-force-container form").submit()', ]); echo $this->Bootstrap->button([ 'text' => __('Migrate meta-fields'), 'variant' => 'success', 'onclick' => '$(".hidden-form-container form").submit()', ]); } ?>