<?php

namespace DropshippingXmlFreeVendor;

use DropshippingXmlFreeVendor\WPDesk\Library\DropshippingXmlCore\Form\Fields\Component\YoastComponent;
/**
 * @var YoastComponent $field
 * @var \WPDesk\View\Renderer\Renderer $renderer
 * @var string $name_prefix
 * @var array|string $value
 */
$name_prefix = $name_prefix . '[' . $field->get_name() . ']';
$get_value = static function (string $field_name) use ($value): string {
    if (\is_array($value) && isset($value[$field_name])) {
        return (string) $value[$field_name];
    }
    return '';
};
?>
<div id="woocommerce-yoast-seo" class="postbox group-switch">
	<h2 class="group-switcher">
		<span><?php 
echo \esc_html__('Yoast SEO', 'dropshipping-xml-for-woocommerce');
?></span>
		<span class="group-arrow dashicons dashicons-arrow-down"></span>
	</h2>
	<div class="inside mapper-postbox__inside">
		<?php 
foreach ($field->get_groups() as $group_id => $group) {
    ?>
			<div class="group-switch group-closed yoast-group">
				<h3 class="group-switcher">
					<span><?php 
    echo \esc_html($group['label']);
    ?></span>
					<span class="group-arrow dashicons dashicons-arrow-down"></span>
				</h3>
				<div class="inside mapper-postbox__inside">
					<?php 
    foreach ($group['fields'] as $meta_key => $label) {
        ?>
						<p class="form-field group-switch__field">
							<label>
								<?php 
        echo \esc_html($label);
        ?>
								<code><?php 
        echo \esc_html($meta_key);
        ?></code>
							</label>
							<input
								type="text"
								name="<?php 
        echo \esc_attr($name_prefix) . '[' . \esc_attr($meta_key) . ']';
        ?>"
								value="<?php 
        echo \esc_attr($get_value($meta_key));
        ?>"
								class="width-100"
								placeholder="<?php 
        echo \esc_attr__('Drag & drop field here', 'dropshipping-xml-for-woocommerce');
        ?>"
							/>
						</p>
					<?php 
    }
    ?>
				</div>
			</div>
		<?php 
}
?>
	</div>
</div>
<?php 
