Commit a2b38834 authored by blazey's avatar blazey Committed by borisson_
Browse files

Issue #2841011 by blazey: Fatal error when trying to translate facet source

parent b4639a4e
......@@ -35,7 +35,7 @@ entity.facets_facet.settings_form:
_entity_access: 'facets_facet.edit'
entity.facets_facet_source.edit_form:
path: '/admin/config/search/facets/facet-sources/{source_id}/edit'
path: '/admin/config/search/facets/facet-sources/{facets_facet_source}/edit'
defaults:
_controller: '\Drupal\facets\Controller\FacetSourceController::facetSourceConfigForm'
_title: 'Edit facet source configuration'
......
......@@ -46,7 +46,7 @@ function core_search_facets_search_plugin_alter(array &$definitions) {
*/
function core_search_facets_form_facet_source_edit_form_alter(&$form, FormStateInterface $form_state) {
$request = \Drupal::requestStack()->getMasterRequest();
$facet_source_id = str_replace(":", "__", $request->attributes->get('source_id'));
$facet_source_id = str_replace(":", "__", $request->attributes->get('facets_facet_source'));
if (strpos($facet_source_id, 'core_node_search') !== FALSE) {
$form['advanced_filters'] = array(
'#type' => 'checkbox',
......
......@@ -12,13 +12,13 @@ class FacetSourceController extends ControllerBase {
/**
* Configuration for the facet source.
*
* @param string $source_id
* @param string $facets_facet_source
* The plugin id.
*
* @return array
* A renderable array containing the form.
*/
public function facetSourceConfigForm($source_id) {
public function facetSourceConfigForm($facets_facet_source) {
// Returns the render array of the FacetSourceConfigForm.
return $this->formBuilder()->getForm('\Drupal\facets\Form\FacetSourceEditForm');
}
......
......@@ -160,7 +160,7 @@ class FacetListBuilder extends ConfigEntityListBuilder {
'data' => Link::createFromRoute(
$this->t('Configure'),
'entity.facets_facet_source.edit_form',
['source_id' => $facet_source['id']]
['facets_facet_source' => $facet_source['id']]
)->toRenderable(),
),
),
......
......@@ -49,7 +49,7 @@ class FacetSourceEditForm extends EntityForm {
// Make sure we remove colons from the source id, those are disallowed in
// the entity id.
$source_id = $this->getRequest()->get('source_id');
$source_id = $this->getRequest()->get('facets_facet_source');
$source_id = str_replace(':', '__', $source_id);
$facet_source = $facet_source_storage->load($source_id);
......@@ -63,7 +63,7 @@ class FacetSourceEditForm extends EntityForm {
$facet_source = new FacetSource(
[
'id' => $source_id,
'name' => $this->getRequest()->get('source_id'),
'name' => $this->getRequest()->get('facets_facet_source'),
],
'facets_facet_source'
);
......
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