wpbones/pure-css-switch 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wpbones/pure-css-switch

Composer 安装命令:

composer require wpbones/pure-css-switch

包简介

Pure CSS Switch Button for WP Bones

README 文档

README

Latest Stable Version   Latest Unstable Version   Total Downloads   License   Monthly Downloads

Pure CSS Switch Button for WordPress/WP Bones

Pure CSS Switch Button for WP Bones

Requirements

This package works with a WordPress plugin written with WP Bones framework library.

Installation

You can install third party packages by using:

php bones require  wpbones/pure-css-switch

I advise to use this command instead of composer require because doing this an automatic renaming will done.

You can use composer to install this package:

composer require  wpbones/pure-css-switch

You may also to add " wpbones/pure-css-switch": "~0.7" in the composer.json file of your plugin:

  "require": {
    "php": ">=7.4",
    "wpbones/wpbones": "~1.5",
    " wpbones/pure-css-tabs": "~0.7"
  },

and run

composer install

Development installation

Use yarn to install the development tools. Next, use gulp --production to compile the resources.

Enqueue for Controller

You can use the provider to enqueue the styles.

public function index()
{
  // enqueue the minified version
  PureCSSSwitchProvider::enqueueStyles();

  // ...

}

PureCSSSwitchProvider

This is a static class autoloaded by composer. You can use it to enqueue or get the styles path:

// enqueue the minified version
PureCSSSwitchProvider::enqueueStyles();

// enqueue the flat version
PureCSSSwitchProvider::enqueueStyles( false );

// return the absolute path of the minified css
PureCSSSwitchProvider::css();

// return the absolute path of the flat css
PureCSSSwitchProvider::css();

Mode

To default the switch works as on/off button. You can change the mode by setting mode property,

<?php echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-7' )
            ->mode( 'select' ); ?>

In the above example, you can use it as selector instead of on/off button.

Theme

Of course, you can switch theme by using theme property ot its fluent version. Currently, we support two theme:

  • flat-round - default
  • flat-square

You should use something look like:

<?php echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-7' )
            ->theme( 'flat-square' ); ?>

Examples

In your view you can use the WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton class

echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-1' );
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-2' )
  ->left_label( 'Swipe me' );
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-3' )
  ->right_label( 'Swipe me' );
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-4' )
  ->left_label( 'Swipe me' )
  ->right_label( 'Swipe me' );
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-5' )
  ->left_label( 'Swipe me' )
  ->checked( true );
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-6' )
  ->left_label( 'Swipe me' )
  ->disabled( true );
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-7' )
  ->theme( 'flat-square' );
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-8' )
  ->left_label( 'Turn left' )
  ->right_label( 'Turn right' )
  ->mode( 'select' );

统计信息

  • 总下载量: 787
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: CSS

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固