Changes for core/modules/media/media.module: 15 added lines, 113 removed lines.
Original line number
Diff line number
Diff line
@@ -6,6 +6,7 @@
useDrupal\Core\Form\FormStateInterface;
useDrupal\Core\Url;
useDrupal\media\Hook\MediaHooks;
useDrupal\media\Hook\MediaThemeHooks;
/**
@@ -43,8 +44,14 @@ function template_preprocess_media(array &$variables): void {
*
* @internal
* This function is internal and may be removed in a minor release.
*
* @deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no
* replacement.
*
* @see https://www.drupal.org/node/3566774
*/
function_media_get_add_url($allowed_bundles){
@trigger_error(__FUNCTION__.'() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3566774',E_USER_DEPRECATED);
// Require `<drupal-media>` HTML tag if filter_html is enabled.
if(!isset($allowed['drupal-media'])){
$form_state->setError($form['filters']['settings']['filter_html']['allowed_html'],t('The %media-embed-filter-label filter requires <code><drupal-media></code> among the allowed HTML tags.',[
$form_state->setError($form['filters']['settings']['filter_html']['allowed_html'],t('The <code><drupal-media></code> tag in the allowed HTML tags is missing the following attributes: <code>%list</code>.',[
'%list'=>implode(', ',$missing_attributes),
]));
}
}
}
$filters=$form_state->getValue('filters');
// The "media_embed" filter must run after "filter_align", "filter_caption",
// and "filter_html_image_secure".
$precedents=[
'filter_align',
'filter_caption',
'filter_html_image_secure',
];
$error_filters=[];
foreach($precedentsas$filter_name){
// A filter that should run before media embed filter.
@trigger_error(__FUNCTION__.'() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. Use \Drupal\media\Hook\MediaHooks::formatEditFormValidate() instead. See https://www.drupal.org/node/3566774',E_USER_DEPRECATED);
$elements['#media_help']['#media_add_help']=$this->t('Create your media on the <a href=":add_page" target="_blank">media add page</a> (opens a new window), then add it by name to the field below.',[':add_page'=>$add_url]);
}
@@ -238,7 +238,7 @@ public function formFilterFormatEditFormAlter(array &$form, FormStateInterface $
// are added automatically by CKEditor 5. The validator would conflict with
// Require `<drupal-media>` HTML tag if filter_html is enabled.
if(!isset($allowed['drupal-media'])){
$form_state->setError($form['filters']['settings']['filter_html']['allowed_html'],$this->t('The %media-embed-filter-label filter requires <code><drupal-media></code> among the allowed HTML tags.',[
$form_state->setError($form['filters']['settings']['filter_html']['allowed_html'],$this->t('The <code><drupal-media></code> tag in the allowed HTML tags is missing the following attributes: <code>%list</code>.',[
'%list'=>implode(', ',$missing_attributes),
]));
}
}
}
$filters=$form_state->getValue('filters');
// The "media_embed" filter must run after "filter_align", "filter_caption",
// and "filter_html_image_secure".
$precedents=[
'filter_align',
'filter_caption',
'filter_html_image_secure',
];
$error_filters=[];
foreach($precedentsas$filter_name){
// A filter that should run before media embed filter.