social_media_links-8.x-2.x-dev/src/Plugin/SocialMediaLinks/Platform/Contact.php
src/Plugin/SocialMediaLinks/Platform/Contact.php
<?php
namespace Drupal\social_media_links\Plugin\SocialMediaLinks\Platform;
use Drupal\Core\Url;
use Drupal\social_media_links\PlatformBase;
/**
* Provides 'contact' platform.
*
* @Platform(
* id = "contact",
* name = @Translation("Contact"),
* iconName = "email",
* )
*/
class Contact extends PlatformBase {
/**
* {@inheritdoc}
*/
public function getUrlPrefix() {
// Get the url of the site as prefix for the url.
$url = Url::fromUserInput('/', ['absolute' => TRUE]);
return $url->toString();
}
/**
* {@inheritdoc}
*/
public function getUrl() {
// Generate the internal url based on the user input.
// See Url::fromUserInput() for more information.
return Url::fromUserInput('/' . $this->getValue() . $this->getUrlSuffix());
}
}
