<div class="page-headline">
    <img src="<?php echo $this->imagePath; ?>/icons/settings.svg" alt="">
    <h3><?php _ex('Blocked Content Types', 'Headline right of icon', 'borlabs-cookie'); ?><?php echo !empty($bctData->name) ? ': '.esc_html($bctData->name) : ''; ?></h3>
</div>
<div class="content">

    <div class="messages">
    <?php echo \BorlabsCookie\Cookie\Backend\Backend::getInstance()->getMessages(); ?>
    </div>

    <form method="post" id="BorlabsCookieForm">

        <?php echo !empty($bctData->description) ? '<p>'.$bctData->description.'</p>' : ''; ?>

        <fieldset>
            <legend><?php _ex('General settings', 'Headline of a fieldset', 'borlabs-cookie'); ?></legend>

            <div class="form-group">
                <div class="form-title"><?php _ex('ID', 'Setting title', 'borlabs-cookie'); ?></div>
                <div class="form-field">
                    <?php
                    if (empty($bctData->id)) {
                    ?>
                    <label for="typeId">
                        <input value="<?php echo $inputTypeId; ?>" type="text" name="typeId" id="typeId" class="regular-text">
                    </label>
                    <span class="description"><?php _ex('Set an id for this Blocked Content Type. The id has to be minimum 3 letters and only contains letters from a-z.', 'Setting description', 'borlabs-cookie'); ?></span>
                    <?php
                    } else {
                        echo $bctData->type_id;
                    }
                    ?>
                </div>
            </div>

            <div class="form-group">
                <div class="form-title"><?php _ex('Status', 'Setting title', 'borlabs-cookie'); ?></div>
                <div class="form-field">
                    <label for="status">
                        <input<?php echo $checkboxStatus; ?> type="checkbox" name="status" id="status" value="1"> <span class="option-title"><?php _ex('Activate', 'Setting checkbox', 'borlabs-cookie'); ?></span>
                    </label>
                    <span class="description"><?php _ex('The status of the Blocked Content Type. If active it does block content (iframes) of the configured hosts.', 'Setting description', 'borlabs-cookie'); ?></span>
                </div>
            </div>

            <div class="form-group">
                <div class="form-title"><?php _ex('Name', 'Setting title', 'borlabs-cookie'); ?></div>
                <div class="form-field">
                    <label for="name">
                        <input value="<?php echo $inputName; ?>" type="text" name="name" id="name" class="regular-text">
                    </label>
                    <span class="description"><?php _ex('The name of the Blocked Content Type which can be used within the <strong>Preview</strong> code by using the variable <strong>%%name%%</strong>.', 'Setting description', 'borlabs-cookie'); ?></span>
                </div>
            </div>

            <div class="form-group">
                <div class="form-title">
                    <label for="hosts"><?php _ex('Host(s)', 'Form', 'borlabs-cookie'); ?></label>
                </div>
                <div class="form-field">
                    <textarea name="hosts" id="hosts" cols="80" rows="5"><?php echo $textareaHosts; ?></textarea>
                    <span class="description"><?php _ex('One host per line. When one host is recognized (for example within the src-attribute of an iframe) this Blocked Content Type will be allocated.', 'Setting description', 'borlabs-cookie'); ?></span>
                </div>
            </div>

            <div class="form-group">
                <div class="form-title">
                    <label for="previewHTML"><?php _ex('Preview', 'Form', 'borlabs-cookie'); ?></label>
                </div>
                <div class="form-field">
                    <textarea name="previewHTML" id="previewHTML" cols="80" rows="5"><?php echo $textareaPreviewHTML; ?></textarea>
                    <span class="description"><?php _ex('This HTML will be displayed for the blocked content. You can use the variable <strong>%%name%%</strong> to display the name of the Blocked Content Type.', 'Setting description', 'borlabs-cookie'); ?></span>
                </div>
            </div>
        </fieldset>

        <fieldset>
            <legend><?php _ex('Advanced settings', 'Headline of a fieldset', 'borlabs-cookie'); ?></legend>
            <div class="form-group">
                <div class="form-title">
                    <label for="globalJS"><?php _ex('Global JavaScript', 'Form', 'borlabs-cookie'); ?></label>
                </div>
                <div class="form-field">
                    <textarea name="globalJS" id="globalJS" cols="80" rows="5"><?php echo $textareaGlobalJS; ?></textarea>
                    <span class="description"><?php _ex('The JavaScript will only be executed once per site when a blocked content will be unblocked. Use this for example to load an external JavaScript library.', 'Setting description', 'borlabs-cookie'); ?></span>
                    <span class="description"><?php _ex('Only use JavaScript, do not use &lt;script&gt;-tags!', 'Setting description', 'borlabs-cookie'); ?></span>
                </div>
            </div>

            <div class="form-group">
                <div class="form-title">
                    <label for="initJS"><?php _ex('Initialization JavaScript', 'Form', 'borlabs-cookie'); ?></label>
                </div>
                <div class="form-field">
                    <textarea name="initJS" id="initJS" cols="80" rows="5"><?php echo $textareaInitJS; ?></textarea>
                    <span class="description"><?php _ex('The JavaScript will always be executed when a blocked content will be unblocked.', 'Setting description', 'borlabs-cookie'); ?></span>
                    <span class="description"><?php _ex('Only use JavaScript, do not use &lt;script&gt;-tags!', 'Setting description', 'borlabs-cookie'); ?></span>
                </div>
            </div>
        </fieldset>

        <fieldset>
            <legend><?php _ex('Additional settings', 'Headline of a fieldset', 'borlabs-cookie'); ?></legend>

            <div class="form-group">
                <div class="form-title"><?php _ex('Unblock all', 'Setting title', 'borlabs-cookie'); ?></div>
                <div class="form-field">
                    <?php
                    if (!empty($bctData->type_id) && $bctData->type_id === 'default') {
                    ?>
                        <div class="messages">
                            <p class="notice"><?php _ex('It is not possible to unblock all content of an unspecific content type.', 'Status message', 'borlabs-cookie'); ?></p>
                        </div>
                    <?php
                    } else {
                        ?>
                        <label for="settingsUnblockAll">
                            <input<?php echo $checkboxSettingsUnblockAll; ?> type="checkbox" name="settings[unblockAll]" id="settingsUnblockAll" value="1"> <span class="option-title"><?php _ex('Activate', 'Setting checkbox', 'borlabs-cookie'); ?></span>
                        </label>
                    <span class="description"><?php _ex('Once the user unblocks a blocked content, all other blocked contents of this type will be automatically unblocked too.', 'Setting description', 'borlabs-cookie'); ?></span>
                    <?php
                    }
                    ?>
                </div>
            </div>

            <?php
            if (!empty($bctData->type_id)) {
                do_action('borlabsCookie/bct/edit_template/'.$bctData->type_id, $bctData);
            }
            ?>

            <hr>
            <?php wp_nonce_field('borlabs_cookie_edit_blocked_content_type'); ?>
            <input type="hidden" name="formSend" value="1">
            <input type="hidden" name="id" value="<?php echo $inputId; ?>">
            <a href="?page=borlabs_cookie_settings&amp;tab=blocked_content_types" class="button-secondary"><?php _ex('Go back without saving', 'Button title', 'borlabs-cookie'); ?></a>
            <input class="button-primary secondary-ahead" type="submit" value="<?php _ex('Save', 'Button title', 'borlabs-cookie'); ?>">

        </fieldset>

    </form>
</div>