承接 statikbe/craft-cta-field 相关项目开发

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

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

statikbe/craft-cta-field

Composer 安装命令:

composer require statikbe/craft-cta-field

包简介

Call to action & link fields made easy

README 文档

README

Requirements

This plugin requires Craft CMS 3.0.0 or later.

Migrating to verbb/hyper

In an effort to phase out the usage of this plugin, we've added 2 console commands to migration the fields and their content to Hyper.

These are the steps you should follow:

  • Install hyper
    ddev composer require "verbb/hyper" -w && ddev exec php craft plugin/install hyper
  • Install Config Values Field
    ddev composer require "statikbe/craft-config-values" -w && ddev exec php craft plugin/install config-values-field
  • Resave and check your supertable tables (visit /admin/super-table/settings and click both buttons)

Caution

If supertable is missing tables/columns, or entire fields are marked as missing - please fix that first before proceeding.

  • Migrate field settings.
    ddev craft cta/migrate/statik-cta-field
    This will transform all your CTA fields to Hyper fields and update their project config files.
  • Migratie field content.
    ddev craft cta/migrate/statik-cta-content
    You'll have to run this on each environment, but only after you ran the fields command or you deployed the changes.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require statikbe/craft-cta-field
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Link Field.

Templating

Link fields on your models will return an instance of cta\models\Link. Rendering a link field directly within a template will return the url the field is pointing to.

<a href="{{ item.myLinkField }}">Link</a>

You can use the following accessors to get the different properties of the link:

{{ item.myLinkField.getElement() }}
{{ item.myLinkField.getTarget() }}
{{ item.myLinkField.getText() }}
{{ item.myLinkField.getUrl() }}
{{ item.myLinkField.hasElement() }}
{{ item.myLinkField.isEmpty() }}

Use the getLink utility function to render a full html link:

{{ item.myLinkField.getLink() }}

You can pass the desired content of the link as a string, e.g.

{{ entry.linkField.getLink('Imprint') }}

You may also pass an array of attributes. When doing this you can override the default attributes href and target. The special attribute text will be used as the link content.

{{ entry.linkField.getLink({
  class: 'my-link-class',
  target: '_blank',
  text: 'Imprint',
}) }}

To get the CTA as a span (eg to use in clickable blocks), you can use the getSpan() function.

{{ entry.linkField.getSpan({
  class: 'my-link-class',
  text: 'Imprint',
}) }}

Configuration

Custom classes

Add custum classes to the dropdown menu.

  1. Add cta.php to /config
  2. Declare your classes:
<?php

return [
    'classes' => [
        'btn'                   => 'Primary',
        'btn btn--secondary'    => 'Secondary'
    ]
];

Linking between sites

By default, linking to entries from another site is not enabled. To make this work, you can use this config setting:

<?php

return [
    'crossSiteLinking' => true
];

Credits

Heavily inspired by sebastian-lenz/craft-linkfield.

statikbe/craft-cta-field 适用场景与选型建议

statikbe/craft-cta-field 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.96k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 07 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 statikbe/craft-cta-field 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-07-26