class MediaFileRedirect in Media Entity File Redirect 8
A substitution plugin for the URL to a file associated with a media entity.
Plugin annotation
@Substitution(
id = "media_file_redirect",
label = @Translation("URL that redirects to direct file path"),
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\media_entity_file_redirect\Plugin\Linkit\Substitution\MediaFileRedirect implements SubstitutionInterface
Expanded class hierarchy of MediaFileRedirect
File
- src/
Plugin/ Linkit/ Substitution/ MediaFileRedirect.php, line 19
Namespace
Drupal\media_entity_file_redirect\Plugin\Linkit\SubstitutionView source
class MediaFileRedirect extends PluginBase implements SubstitutionInterface {
/**
* {@inheritdoc}
*/
public function getUrl(EntityInterface $entity) {
return Url::fromRoute('media_entity_file_redirect.file_redirect', [
'media' => $entity
->id(),
])
->toString(TRUE);
}
/**
* {@inheritdoc}
*/
public static function isApplicable(EntityTypeInterface $entity_type) {
return $entity_type
->entityClassImplements('Drupal\\media\\MediaInterface');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MediaFileRedirect:: |
public | function |
Get the URL associated with a given entity. Overrides SubstitutionInterface:: |
|
MediaFileRedirect:: |
public static | function |
Checks if this substitution plugin is applicable for the given entity type. Overrides SubstitutionInterface:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 92 |