function media_help
Same name in other branches
- 9 core/modules/media/media.module \media_help()
- 8.9.x core/modules/media/media.module \media_help()
- 11.x core/modules/media/media.module \media_help()
Implements hook_help().
File
-
core/
modules/ media/ media.module, line 28
Code
function media_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.media':
$output = '<h2>' . t('About') . '</h2>';
$output .= '<p>' . t('The Media module manages the creation, editing, deletion, settings, and display of media. Items are typically images, documents, slideshows, YouTube videos, tweets, Instagram photos, etc. You can reference media items from any other content on your site. For more information, see the <a href=":media">online documentation for the Media module</a>.', [
':media' => 'https://www.drupal.org/docs/8/core/modules/media',
]) . '</p>';
$output .= '<h2>' . t('Uses') . '</h2>';
$output .= '<dl>';
$output .= '<dt>' . t('Creating media items') . '</dt>';
$output .= '<dd>' . t('When a new media item is created, the Media module records basic information about it, including the author, date of creation, and the <a href=":media-type">media type</a>. It also manages the <em>publishing options</em>, which define whether or not the item is published. Default settings can be configured for each type of media on your site.', [
':media-type' => Url::fromRoute('entity.media_type.collection')->toString(),
]) . '</dd>';
$output .= '<dt>' . t('Listing media items') . '</dt>';
$output .= '<dd>' . t('Media items are listed at the <a href=":media-collection">media administration page</a>.', [
':media-collection' => Url::fromRoute('entity.media.collection')->toString(),
]) . '</dd>';
$output .= '<dt>' . t('Creating custom media types') . '</dt>';
$output .= '<dd>' . t('The Media module gives users with the <em>Administer media types</em> permission the ability to <a href=":media-new">create new media types</a> in addition to the default ones already configured. Each media type has an associated media source (such as the image source) which support thumbnail generation and metadata extraction. Fields managed by the <a href=":field">Field module</a> may be added for storing that metadata, such as width and height, as well as any other associated values.', [
':media-new' => Url::fromRoute('entity.media_type.add_form')->toString(),
':field' => Url::fromRoute('help.page', [
'name' => 'field',
])->toString(),
]) . '</dd>';
$output .= '<dt>' . t('Creating revisions') . '</dt>';
$output .= '<dd>' . t('The Media module also enables you to create multiple versions of any media item, and revert to older versions using the <em>Revision information</em> settings.') . '</dd>';
$output .= '<dt>' . t('User permissions') . '</dt>';
$output .= '<dd>' . t('The Media module makes a number of permissions available, which can be set by role on the <a href=":permissions">permissions page</a>.', [
':permissions' => Url::fromRoute('user.admin_permissions.module', [
'modules' => 'media',
])->toString(),
]) . '</dd>';
$output .= '<dt>' . t('Adding media to other content') . '</dt>';
$output .= '<dd>' . t('Users with permission to administer content types can add media support by adding a media reference field to the content type on the content type administration page. (The same is true of block types, taxonomy terms, user profiles, and other content that supports fields.) A media reference field can refer to any configured media type. It is possible to allow multiple media types in the same field.') . '</dd>';
$output .= '</dl>';
$output .= '<h2>' . t('Differences between Media, File, and Image reference fields') . '</h2>';
$output .= '<p>' . t('<em>Media</em> reference fields offer several advantages over basic <em>File</em> and <em>Image</em> references:') . '</p>';
$output .= '<ul>';
$output .= '<li>' . t('Media reference fields can reference multiple media types in the same field.') . '</li>';
$output .= '<li>' . t('Fields can also be added to media types themselves, which means that custom metadata like descriptions and taxonomy tags can be added for the referenced media. (Basic file and image fields do not support this.)') . '</li>';
$output .= '<li>' . t('Media types for audio and video files are provided by default, so there is no need for additional configuration to upload these media.') . '</li>';
$output .= '<li>' . t('Contributed or custom projects can provide additional media sources (such as third-party websites, Twitter, etc.).') . '</li>';
$output .= '<li>' . t('Existing media items can be reused on any other content items with a media reference field.') . '</li>';
$output .= '</ul>';
$output .= '<p>' . t('Use <em>Media</em> reference fields for most files, images, audio, videos, and remote media. Use <em>File</em> or <em>Image</em> reference fields when creating your own media types, or for legacy files and images created before installing the Media module.') . '</p>';
return $output;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.