Commit 1309762f authored by Kingdutch's avatar Kingdutch
Browse files

Don't hardcode analysis preview route in Javascript

parent a7d1fe66
...@@ -215,8 +215,7 @@ ...@@ -215,8 +215,7 @@
var self = this; var self = this;
this.$form.ajaxSubmit({ this.$form.ajaxSubmit({
// TODO: This endpoint probably shouldn't be static. url: this.config.analysis_endpoint,
url: '/yoast_seo/preview',
data: { data: {
yoast_seo_preview: { yoast_seo_preview: {
path: drupalSettings.path.currentPath, path: drupalSettings.path.currentPath,
......
...@@ -10,6 +10,7 @@ use Drupal\Core\Field\WidgetBase; ...@@ -10,6 +10,7 @@ use Drupal\Core\Field\WidgetBase;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Url;
use Drupal\yoast_seo\SeoManager; use Drupal\yoast_seo\SeoManager;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -177,6 +178,8 @@ class YoastSeoWidget extends WidgetBase implements ContainerFactoryPluginInterfa ...@@ -177,6 +178,8 @@ class YoastSeoWidget extends WidgetBase implements ContainerFactoryPluginInterfa
'base_root' => $base_root, 'base_root' => $base_root,
// Set up score to indiciator word rules. // Set up score to indiciator word rules.
'score_status' => $score_to_status_rules, 'score_status' => $score_to_status_rules,
// Set up our analysis endpoint.
'analysis_endpoint' => Url::fromRoute('yoast_seo.entity_preview')->toString(),
]; ];
// Set up the names of the text outputs. // Set up the names of the text outputs.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment