Skip to content

Commit

Permalink
empty text for urls
Browse files Browse the repository at this point in the history
  • Loading branch information
nateiler committed Apr 9, 2019
1 parent 4cdc0fc commit f27a558
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All Notable changes to `flipboxfactory/craft-link` will be documented in this file

## 1.1.3 - 2019-3-8
### Added
- Url links will not

## 1.1.2 - 2019-3-8
### Fixed
- Multi-site localization issues w/ element link types
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "flipboxfactory/craft-link",
"description": "Link Field Type for Craft CMS",
"version": "1.1.2",
"version": "1.1.3",
"type": "craft-plugin",
"keywords": [
"flipbox",
Expand Down
24 changes: 13 additions & 11 deletions src/types/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

namespace flipbox\craft\link\types;

use flipbox\craft\link\Link;

/**
* @author Flipbox Factory <[email protected]>
* @since 1.0.0
Expand All @@ -29,11 +31,6 @@ class Url extends AbstractType
*/
const INPUT_TEMPLATE_PATH = self::BASE_TEMPLATE_PATH . '/input';

/**
* @var bool
*/
public $allowEmptyText = true;

/**
* @var
*/
Expand All @@ -49,19 +46,25 @@ class Url extends AbstractType
*/
public static function displayName(): string
{
return \flipbox\craft\link\Link::t('Url');
return Link::t('Url');
}

/**
* @inheritdoc
*/
public function getText()
{
if ($this->allowText && $this->overrideText !== null) {
return $this->overrideText;
if ($this->allowText) {
if ($this->overrideText !== null) {
return $this->overrideText;
}

if (!$this->requireText) {
return null;
}
}

return $this->allowEmptyText ? null : $this->getUrl();
return $this->getUrl();
}

/**
Expand All @@ -80,8 +83,7 @@ public function settings(): array
return array_merge(
parent::settings(),
[
'placeholder',
'allowEmptyText'
'placeholder'
]
);
}
Expand Down

0 comments on commit f27a558

Please sign in to comment.