承接 iqnection-modules/linkfield 相关项目开发

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

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

iqnection-modules/linkfield

Composer 安装命令:

composer require iqnection-modules/linkfield

包简介

SilverStripe Link Field

README 文档

README

Works just like the RedirectorPage URL/Page field Provides and interface for creating an internal or external link. Internal link provides a TreeDropdownField for selecting a page within the site tree External provides a text field for entering the full URL Also provides availability to store opening in a new tab

Requirements

Silverstripe 4+

Install

composer require iqnection-modules/linkfield

Usage

In your DataObject class, use the DB field "Link"

private static $db = array(
	'LinkedPage' => 'Link'
);

In your forms (CMS only)

$fields->push( IQnection\LinkField\LinkField::create($name,$title) );

setValue() expects either an array or serialized array of the following:

array(
	'Location' => string ['Internal' | 'External'] (required)
	'Internal' => int [SiteTree Page ID]
	'External' => string [external URL | null],
	'NewTab' => [bool]
);

In your templates

<a href="$LinkedPage">Link Text</a>

DB class methods

URL

the raw entered URL for External, or $Page->Link() for internal

AbsoluteURL

an absolute URL for external (adds http://), or $Page->AbsoluteLink() for internal

LinkedPage

for internal only, returns the linked page SiteTree object

forTemplate

returns URL()

IsExternal

returns bool, if the link is external

Location

returns string, the location set as either Internal or External

Target

returns _blank or self for use in a target HTML attribute

TargetATT(force=false)

returns a full target attribute, for new tab only [target="_blank"] pass $force=true to return attribute for both new tab and same tab

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-08-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固