2017 © Pedro Peláez
 

craft-plugin advanced-url-field

Configurable URL field that provides multiple format restrictions and validation.

image

charliedev/advanced-url-field

Configurable URL field that provides multiple format restrictions and validation.

  • Wednesday, December 13, 2017
  • by charliedev
  • Repository
  • 3 Watchers
  • 5 Stars
  • 1,019 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 122 % Grown

The README.md

Advanced URL Field for Craft 3

This plugin provides a field type that can be configured to only allow URLs that match a specific set of formats. It expands upon the built-in URL field by allowing a field to be set to absolute, relative, mailto, or tel uris., (*1)

Requirements

  • Craft CMS 3.0.0-RC1 or above

Installation

  1. Open a terminal and navigate to your project folder:
cd /path/to/project
  1. Require the package to download it via Composer:
composer require charliedev/advanced-url-field
  1. Install the plugin on the Settings -> Plugins page in the Craft control panel.

--- or ---, (*2)

  1. Install the plugin via the command line:
./craft install/plugin advanced-url-field

Usage

Creating an Advanced URL Field

  1. Create a new field in your craft control panel via the Settings -> Fields panel.
  2. Select Advanced URL as the field type.
  3. Fill out placeholder text to show when the field is blank.
  4. Select which URL types to allow (more info on the types below).
  5. Attach the new field to a section.

Screenshot of field creation screen, (*3)

URL Types

  • Relative URLS must match the format of a URL path, relative to the document root, for example /about or /categories/new#first.
  • Absolute URLS must match a full absolute url, prefixed with protocol and containing a domain name, for example https://www.example.com/ or https://example.com/about.
  • Mailto Protocol must be an email address prefixed by mailto:.
  • Tel Protocol must be a phone number prefixed by tel:.

Templating with an Advanced URL Field

In a Twig template, the field is rendered directly, without any other additional inner properties. See the following example, where myURL is an Advanced URL field on the entry:, (*4)

<a href="{{ entry.myURL }}">My Link</a>

Built for Craft CMS by Charlie Development, (*5)

The Versions

13/12 2017

dev-master

9999999-dev

Configurable URL field that provides multiple format restrictions and validation.

  Sources   Download

MIT

The Requires

 

url cms field craftcms craft

13/12 2017

1.0.0

1.0.0.0

Configurable URL field that provides multiple format restrictions and validation.

  Sources   Download

MIT

The Requires

 

url cms field craftcms craft