Skip to content

Commit

Permalink
I messed up. Fix my copy and paste error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonassiewertsen authored Aug 8, 2021
1 parent 8941fc7 commit 9644821
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions src/ExternalLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,57 +46,6 @@ public function preProcess($data)
{
return preg_replace('/^(http|https):\/\//i', '', $data);
}

<?php

namespace Jonassiewertsen\ExternalLink;

use Statamic\Fields\Fieldtype;

class ExternalLink extends Fieldtype
{
protected $icon = 'earth';

protected $categories = ['text'];

protected $regexPattern = '/^(http|https):\/\//i';

/**
* @return string
*/
public static function title()
{
return 'External Link';
}

/**
* Adding the https:// before saving
*
* @param $data
*
* @return string
*/
public function process($data)
{
if (! $data) {
return;
}

return 'https://' . $data;
}


/**
* Removing the https:// before displaying in field
*
* @param $data
*
* @return mixed
*/
public function preProcess($data)
{
$data = preg_replace($this->regexPattern, '', $data);
}

/**
* Augment the value, which will return false in
Expand All @@ -115,5 +64,3 @@ public function augment($value)
return $value;
}
}

}

0 comments on commit 9644821

Please sign in to comment.