Inpsyde\MultilingualPress\Asset\AssetManager::enqueue_style PHP Метод

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

Enqueues the style with the given handle.
С версии: 3.0.0
public enqueue_style ( Inpsyde\MultilingualPress\Asset\Style | string $style ) : boolean
$style Inpsyde\MultilingualPress\Asset\Style | string Style object or handle.
Результат boolean Whether or not the style was enqueued successfully.
    public function enqueue_style($style)
    {
        $handle = (string) $style;
        if (empty($this->styles[$handle])) {
            return false;
        }
        if (wp_style_is($handle)) {
            return true;
        }
        $this->enqueue(function () use($handle) {
            $style = $this->styles[$handle];
            wp_enqueue_style($handle, $style->url(), $style->dependencies(), $style->version(), $style->media());
        });
        return true;
    }

Usage Example

Пример #1
0
    /**
     * Renders the markup.
     *
     * @since 3.0.0
     *
     * @return void
     */
    public function render()
    {
        $this->asset_manager->enqueue_style('multilingualpress-admin');
        $action = PluginSettingsUpdater::ACTION;
        ?>
		<div class="wrap">
			<h1><?php 
        echo esc_html(get_admin_page_title());
        ?>
</h1>
			<form method="post" action="<?php 
        echo admin_url("admin-post.php?action={$action}");
        ?>
"
				id="multilingualpress-modules">
				<?php 
        echo \Inpsyde\MultilingualPress\nonce_field($this->nonce);
        ?>
				<table class="mlp-module-list">
					<?php 
        foreach ($this->module_manager->get_modules() as $id => $module) {
            /**
             * Filters if the module should be listed on the settings page.
             *
             * @since 3.0.0
             *
             * @param bool $show_module Whether or not the module should be listed on the settings page.
             */
            if (apply_filters("multilingualpress.show_module_{$id}", true)) {
                $this->render_module($module);
            }
        }
        /**
         * Fires at the end of but still inside the module list on the settings page.
         *
         * @since 3.0.0
         */
        do_action('multilingualpress.in_module_list');
        ?>
				</table>
				<?php 
        /**
         * Fires right after after the module list on the settings page.
         *
         * @since 3.0.0
         */
        do_action('multilingualpress.after_module_list');
        submit_button(__('Save Changes', 'multilingual-press'));
        ?>
			</form>
		</div>
		<?php 
    }
All Usage Examples Of Inpsyde\MultilingualPress\Asset\AssetManager::enqueue_style