CPTP_Module_Admin::setting_structure_callback_function PHP Метод

setting_structure_callback_function() публичный Метод

    public function setting_structure_callback_function($option)
    {
        $post_type = $option['post_type'];
        $name = $option['label_for'];
        $pt_object = get_post_type_object($post_type);
        $slug = $pt_object->rewrite['slug'];
        $with_front = $pt_object->rewrite['with_front'];
        $value = CPTP_Util::get_permalink_structure($post_type);
        $disabled = false;
        if (isset($pt_object->cptp_permalink_structure) and $pt_object->cptp_permalink_structure) {
            $disabled = true;
        }
        if (!$value) {
            $value = CPTP_DEFAULT_PERMALINK;
        }
        global $wp_rewrite;
        $front = substr($wp_rewrite->front, 1);
        if ($front and $with_front) {
            $slug = $front . $slug;
        }
        ?>
		<p>
			<code><?php 
        echo esc_html(home_url() . ($slug ? '/' : '') . $slug);
        ?>
</code>
			<input name="<?php 
        echo esc_attr($name);
        ?>
" id="<?php 
        echo esc_attr($name);
        ?>
" type="text"
			       class="regular-text code "
			       value="<?php 
        echo esc_attr($value);
        ?>
" <?php 
        disabled($disabled, true, true);
        ?>
 />
		</p>
		<p>has_archive: <code><?php 
        echo esc_html($pt_object->has_archive ? 'true' : 'false');
        ?>
</code> / with_front:
			<code><?php 
        echo esc_html($pt_object->rewrite['with_front'] ? 'true' : 'false');
        ?>
</code></p>
		<?php 
    }