function MediaHooks::fileMediaHelpText

Provides help text to choose between File and Media reference fields.

Return value

string|\Drupal\Core\StringTranslation\TranslatableMarkup A suggestion of when to use Media fields instead of File or Image fields.

2 calls to MediaHooks::fileMediaHelpText()
MediaHooks::fieldTypeCategoryInfoAlter in core/modules/media/src/Hook/MediaHooks.php
Implements hook_field_type_category_info_alter().
MediaHooks::formFieldUiFieldStorageAddFormAlter in core/modules/media/src/Hook/MediaHooks.php
Implements hook_form_FORM_ID_alter().

File

core/modules/media/src/Hook/MediaHooks.php, line 119

Class

MediaHooks
Hook implementations for media.

Namespace

Drupal\media\Hook

Code

protected function fileMediaHelpText() : string|TranslatableMarkup {
  $help_text = $this->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.');
  if (\Drupal::moduleHandler()->moduleExists('help')) {
    $help_text .= ' ' . $this->t('For more information, see the <a href="@help_url">Media help page</a>.', [
      '@help_url' => Url::fromRoute('help.page', [
        'name' => 'media',
      ])->toString(),
    ]);
  }
  return $help_text;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.