for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (c) Flipbox Digital Limited
* @license https://raw.githubusercontent.com/flipboxfactory/craft-link/master/LICENSE
* @link https://github.com/flipboxfactory/craft-link
*/
namespace flipbox\craft\link\types;
use flipbox\craft\link\Link;
* @author Flipbox Factory <[email protected]>
* @since 1.1.0
class Email extends AbstractType
{
* The base template path to the field type templates
const BASE_TEMPLATE_PATH = AbstractType::BASE_TEMPLATE_PATH . '/email';
* The settings template path
const SETTINGS_TEMPLATE_PATH = self::BASE_TEMPLATE_PATH . '/settings';
* The input template path
const INPUT_TEMPLATE_PATH = self::BASE_TEMPLATE_PATH . '/input';
* @var
public $email;
* @var string|null The input’s placeholder text
public $placeholder;
* @inheritdoc
public static function displayName(): string
return Link::t('Email');
}
* @return string
public function getUrl(): string
return $this->email ? ('mailto:' . $this->email) : '';
public function settings(): array
return array_merge(
parent::settings(),
[
'placeholder'
]
);
public function attributes()
parent::attributes(),
'email'
public function rules()
parent::rules(),
],
'email',
'on' => [
self::SCENARIO_INPUT
'required',
'safe',
self::SCENARIO_DEFAULT