false );
// Loop through each shortcode building content
foreach( $evolution_shortcodes as $key => $shortcode ) {
// Add shortcode templates to be used when building with JS
$shortcode_template = ' data-shortcode-template="' . $shortcode['template'] . '"';
if( array_key_exists('child_shortcode', $shortcode ) ) {
$shortcode_template .= ' data-shortcode-child-template="' . $shortcode['child_shortcode']['template'] . '"';
}
// Individual shortcode 'block'
$html .= '
';
// If shortcode has children, it can be cloned and is sortable.
// Add a hidden clone template, and set clone button to be displayed.
if( array_key_exists('child_shortcode', $shortcode ) ) {
$html .= (isset($shortcode['child_shortcode']['shortcode']) ? $shortcode['child_shortcode']['shortcode'] : null);
$shortcode['params'] = $shortcode['child_shortcode']['params'];
$clone_button['show'] = true;
$clone_button['text'] = $shortcode['child_shortcode']['clone_button'];
$html .= '
';
$html .= '
';
foreach( $shortcode['params'] as $key => $param ) {
$html .= $this->evolution_build_fields($key, $param);
}
if( $clone_button['show'] ) {
$html .= '| ' . __('Remove', 'evo-shortcodes') . ' |
';
}
$html .= '
';
}
// Build the actual shortcode input fields
$html .= '
';
foreach( $shortcode['params'] as $key => $param ) {
$html .= $this->evolution_build_fields($key, $param);
}
// Add a link to remove a content block
if( $clone_button['show'] ) {
$html .= '| ' . __('Remove', 'evo-shortcodes') . ' |
';
}
$html .= '
';
// Close out the sortable div and display the clone button as needed
if( $clone_button['show'] ) {
$html .= '
';
$html .= '
' . $clone_button['text'] . '';
$clone_button['show'] = false;
}
// Display notes if provided
if( array_key_exists('notes', $shortcode) ) {
$html .= '
' . $shortcode['notes'] . '
';
}
$html .= '