<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Fields_View_Helper_FieldSpotify extends Fields_View_Helper_FieldAbstract
{
  public function fieldSpotify($subject, $field, $value)
  {
   $regex = '/^((http(s|):\/\/|)(www\.|)|)open\.spotify\.com\/user\//i';
    
    $username = preg_replace($regex, '', trim($value->value));
    $spotUrl = 'https://open.spotify.com/user/' .  $username;
    
    return $this->view->htmlLink($spotUrl, $value->value, array(
      'target' => '_blank',
      'ref' => 'nofollow',
    ));
    
  }
}