定制 getolympus/olympus-dionysos-field-color 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

getolympus/olympus-dionysos-field-color

Composer 安装命令:

composer require getolympus/olympus-dionysos-field-color

包简介

Color field, this component is a part of the Olympus Dionysos fields.

README 文档

README

This component is a part of the Olympus Dionysos fields for WordPress.
It uses the default WordPress color field.

composer require getolympus/olympus-dionysos-field-color

Olympus Component CodeFactor Grade Packagist Version MIT

Field initialization

Use the following lines to add a color field in your WordPress admin pages or custom post type meta fields:

return \GetOlympus\Dionysos\Field\Color::build('my_color_field_id', [
    'title'       => 'What is your favorite Coke?',
    'default'     => '#f40000',
    'description' => 'Zero and Light are not available colors!',

    /**
     * Color picker settings
     * @see https://core.trac.wordpress.org/browser/trunk/src/js/_enqueues/lib/color-picker.js
     */
    'settings' => [
        'defaultColor' => false,
        'hide'         => true,
        'palettes'     => true,
        'width'        => 255,
        'mode'         => 'hsv',
        'type'         => 'full',
        'slider'       => 'horizontal',
    ],
]);

Variables definitions

Variable Type Default value if not set Accepted values
title String 'Color' empty
default String empty Hex color code
description String empty empty
settings Array see Field initialization see WordPress reference

Retrive data

Retrieve your value from Database with a simple get_option('my_color_field_id', '') (see WordPress reference).

// Get color from Database
$color = get_option('my_color_field_id', '#f40000');

// Display Coca-Cola baseline in color
echo 'Always <b style="color:'.$color.'">Coca-Cola</b>';

Release History

0.0.13

  • Use default getVars Zeus-Core method. No need to override it anymore

0.0.12

  • New Olympus components compatibility
  • Change repository to be a part of Dionysos fields

0.0.11

  • FIX: json encoder in twig source file

Contributing

  1. Fork it (https://github.com/GetOlympus/olympus-dionysos-field-color/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Built with ♥ by Achraf Chouk ~ (c) since a long time.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固