承接 sanatorium/inputs 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

sanatorium/inputs

Composer 安装命令:

composer require sanatorium/inputs

包简介

Extended input types

README 文档

README

Extended input types

Documentation

Available input types

Category

Pick category from tree (to be deprecated >> see Relation).

Country

Pick country from list.

Date

Date formatted input.

Email

E-mail formatted input.

File

Pick single file from media library. child type to Media

Gallery

Pick multiple images from media library. child type to Media

Image

Pick single image from media library. child type to Media

Media

Pick multiple files from media library, also a parent for File, Gallery, Image, Video.

Phone

Phone formatted input.

Relation

Relation to another entity.

To register new extension, use:

try
{
    // Register new relation
    $this->app['sanatorium.inputs.relations']->registerRelation(
        'qualification', 'Sleighdogs\Qualifications\Models\Qualification'
    );
    //
} catch (\ReflectionException $e)
{
    // sanatorium/inputs is not installed or does not support relations
}

Note: Code above has to be booted after sanatorium/inputs for that to work properly, therefore remember to register any extension using this code as dependent on sanatorium/inputs (see block require in extension.php of your extension)

Repeater

Multiple input values

Scale

1-100 (to be extended) slider scale input.

Switchery

One or multiple (allowOptions) checkboxes with "switchery look".

Tags

Multiselect which allows user's with permissions to add new values.

Truefalse

Single true/false value.

URL

URL link input.

Video

Pick single video from media library. child type to Media

WYSIWYG

WYSIWYG editor input field.

Create custom type

  1. Create new class in Sanatorium\Inputs\Types namespace, that might look like this

     <?php
    
     namespace Sanatorium\Inputs\Types;
    
     class ScaleType extends BaseType
     {
     
         public $settings = [
     
             'min' => [
                 'name'      => 'sanatorium/inputs::types.settings.min',
                 'default'   => 0,
                 'validation'=> 'numeric|max:max',
                 'type'      => 'number'
             ],
     
             'max' => [
                 'name'      => 'sanatorium/inputs::types.settings.max',
                 'default'   => 100,
                 'validation'=> 'numeric|min:min',
                 'type'      => 'number',
             ]
     
         ];
         
         /**
          * {@inheritDoc}
          */
         protected $identifier = 'scale';
    
     }
    
  2. Register that class in Sanatorium\Inputs\Providers\InputServiceProvider::registerTypes() method

     $types = [
       ...
       'date'		 	=> new Types\ScaleType,
     ];
    
  3. Create templates to display the custom type on frontend and backend in sanatorium/inputs::types/{typeidentifider} theme path. (For example: /themes/admin/default/packages/sanatorium/input/views/types/scale.blade.php and /themes/frontend/default/packages/sanatorium/input/views/types/scale.blade.php)

Widgets

@display

Widget to show media input types

{{-- Show single image --}}
@display($product, 'cover_image', 'single')

{{-- Show gallery images --}}
@display($product, 'gallery', 'multiple')

@displaygroup

Widget to show values of input group

{{-- Show input group table --}}

@displaygroup($product, 'Technical information')

Functions

All functions below are not namespaced and you can find their code in src/helpers.php

Media related

storage_url($media);        // Link to media on any storage

thumbnail_url($media, $width = 300, $height = 300)  // Link to thumbnail

mime2Extension($mime, $extension = '')  // Returns most common extension to mime type

Select, checkbox, multiselect functions

get_attribute_label

get_attribute_label($key, $slug)  // Return label of single selected value

get_attribute_labels

get_attribute_labels($keys = [], $slug, $return = 'string', $implode = ', ') // Return labels of selected values

Returns for example

get_attribute_labels($product->animal, 'animal', 'array')  // => array ('cow' => 'Cow')

Display values related

str_scheme($url, $scheme = 'http://'); // Add protocol if missing

str_links($text);      // Turn URLs in content to <a href>

Theme related

theme_set($theme);          // Set active theme

theme_set_fallback($theme); // Set fallback theme

theme_set_area($area);      // Set area of theme (admin|frontend)

theme_frontend();           // Shorthand for theme_set_area('frontend');

theme_admin();              // Shorthand for theme_set_area('admin');

Changelog

  • 4.3.0 - 2016-09-25 - Repeater now allows sub field definition
  • 4.1.6 - 2016-09-21 - "required" settings on input groups
  • 4.1.0 - 2016-09-18 - Theme related functions, added @display theme partials
  • 4.0.0 - 2016-09-15 - Tags field
  • 3.0.0 - 2016-08-31 - Supports Platform v5.0
  • 1.2.0 - 2016-08-06 - Added relation, url, phone, email, supports grouping
  • 0.1.8 - 2016-05-16 - Basic readme file

Support

Support not available.

sanatorium/inputs 适用场景与选型建议

sanatorium/inputs 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 10 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「extension」 「laravel」 「platform」 「cartalyst」 「madeinsane」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 sanatorium/inputs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sanatorium/inputs 我们能提供哪些服务?
定制开发 / 二次开发

基于 sanatorium/inputs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-10-02