Yoast_Plugin_Conflict::set_error
Setting an error on the screen.
Метод класса: Yoast_Plugin_Conflict{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->set_error( $plugin_section, $readable_plugin_section );
- $plugin_section(строка) (обязательный)
- Type of conflict group (such as Open Graph or sitemap).
- $readable_plugin_section(строка) (обязательный)
- This is the value for the translation.
Код Yoast_Plugin_Conflict::set_error() Yoast Plugin Conflict::set error Yoast 27.7
protected function set_error( $plugin_section, $readable_plugin_section ) {
$notification_center = Yoast_Notification_Center::get();
foreach ( $this->active_conflicting_plugins[ $plugin_section ] as $plugin_file ) {
$plugin_name = $this->get_plugin_name( $plugin_file );
$error_message = '';
/* translators: %1$s: 'Facebook & Open Graph' plugin name(s) of possibly conflicting plugin(s), %2$s to Yoast SEO */
$error_message .= '<p>' . sprintf( __( 'The %1$s plugin might cause issues when used in conjunction with %2$s.', 'wordpress-seo' ), '<em>' . $plugin_name . '</em>', 'Yoast SEO' ) . '</p>';
$error_message .= '<p>' . sprintf( $readable_plugin_section, 'Yoast SEO', $plugin_name ) . '</p>';
/* translators: %s: 'Facebook' plugin name of possibly conflicting plugin */
$error_message .= '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=all', 'deactivate-plugin_' . $plugin_file ) . '">' . sprintf( __( 'Deactivate %s', 'wordpress-seo' ), $this->get_plugin_name( $plugin_file ) ) . '</a> ';
$identifier = $this->get_notification_identifier( $plugin_file );
// Add the message to the notifications center.
$notification_center->add_notification(
new Yoast_Notification(
$error_message,
[
'type' => Yoast_Notification::ERROR,
'id' => 'wpseo-conflict-' . $identifier,
],
),
);
}
}