Commit 5d62cfb6 authored by ifrik's avatar ifrik Committed by borisson_

Issue #2872305 by ifrik: Edit descriptions of facet settings

parent 7242635e
......@@ -320,23 +320,23 @@ class FacetForm extends EntityForm {
$form['facet_settings']['only_visible_when_facet_source_is_visible'] = [
'#type' => 'checkbox',
'#title' => $this->t('Hide facet when facet source is not rendered'),
'#description' => $this->t('When checked, this facet will only be rendered when the facet source is rendered. If you want to show facets on other pages too, you need to uncheck this setting.'),
'#description' => $this->t('Only display the facet if the facet source is rendered. If you want to display the facets on other pages too, you need to uncheck this setting.'),
'#default_value' => $widget->isPropertyRequired('only_visible_when_facet_source_is_visible', 'settings') ?: $facet->getOnlyVisibleWhenFacetSourceIsVisible(),
'#disabled' => $widget->isPropertyRequired('only_visible_when_facet_source_is_visible', 'settings') ?: 0,
];
$form['facet_settings']['show_only_one_result'] = [
'#type' => 'checkbox',
'#title' => $this->t('Make sure only one result can be shown.'),
'#description' => $this->t('When checked, this will make sure that only one result can be selected for this facet at one time.'),
'#title' => $this->t('Ensure that only one result can be displayed'),
'#description' => $this->t('Check this to ensure that only <em>one</em> result at a time can be selected for this facet.'),
'#default_value' => $widget->isPropertyRequired('show_only_one_result', 'settings') ?: $facet->getShowOnlyOneResult(),
'#disabled' => $widget->isPropertyRequired('show_only_one_result', 'settings') ?: 0,
];
$form['facet_settings']['url_alias'] = [
'#type' => 'textfield',
'#title' => $this->t('Url alias'),
'#description' => $this->t('This will appear in the URL to identify this facet. Cannot be blank. Only letters, digits and the dot ("."), hyphen ("-"), underscore ("_"), and tilde ("~") characters are allowed.'),
'#title' => $this->t('URL alias'),
'#description' => $this->t('The alias appears in the URL to identify this facet. It cannot be blank. Allowed are only letters, digits and the following characters: dot ("."), hyphen ("-"), underscore ("_"), and tilde ("~").'),
'#default_value' => $facet->getUrlAlias(),
'#maxlength' => 50,
'#required' => TRUE,
......@@ -348,7 +348,7 @@ class FacetForm extends EntityForm {
'#title' => $this->t('Empty facet behavior'),
'#default_value' => $empty_behavior_config['behavior'] ?: 'none',
'#options' => ['none' => $this->t('Do not display facet'), 'text' => $this->t('Display text')],
'#description' => $this->t('The action to take when a facet has no items.'),
'#description' => $this->t('Take this action if a facet has no items.'),
'#required' => TRUE,
];
$form['facet_settings']['empty_behavior_container'] = [
......@@ -392,7 +392,7 @@ class FacetForm extends EntityForm {
$form['facet_settings']['exclude'] = [
'#type' => 'checkbox',
'#title' => $this->t('Exclude'),
'#description' => $this->t('Make the search exclude selected facets, instead of restricting it to them.'),
'#description' => $this->t('Exclude the selected facets from the search result instead of restricting it to them.'),
'#default_value' => $facet->getExclude(),
];
......@@ -445,7 +445,7 @@ class FacetForm extends EntityForm {
'#type' => 'number',
'#title' => $this->t('Minimum count'),
'#default_value' => $facet->getMinCount(),
'#description' => $this->t('The minimum amount a result needs to have for it to show up in the results.'),
'#description' => $this->t('Only display the results if there is this minimum amount of results.'),
'#maxlength' => 4,
'#required' => TRUE,
];
......@@ -593,10 +593,10 @@ class FacetForm extends EntityForm {
// Validate url alias.
$url_alias = $form_state->getValue(['facet_settings', 'url_alias']);
if ($url_alias == 'page') {
$form_state->setErrorByName('url_alias', $this->t('This url alias is not allowed.'));
$form_state->setErrorByName('url_alias', $this->t('This URL alias is not allowed.'));
}
elseif (preg_match('/[^a-zA-Z0-9_~\.\-]/', $url_alias)) {
$form_state->setErrorByName('url_alias', $this->t('Url alias has illegal characters.'));
$form_state->setErrorByName('url_alias', $this->t('The URL alias contains characters that are not allowed.'));
}
// @todo: validate if url_alias is already used by another facet with the
// same facet source.
......
......@@ -13,7 +13,7 @@ use Drupal\facets\Processor\ProcessorPluginBase;
* @FacetsProcessor(
* id = "boolean_item",
* label = @Translation("Boolean item label"),
* description = @Translation("Fields that are boolean can use this processor to show the configured On/Off values instead of values 0,1"),
* description = @Translation("Display configurable On/Off labels instead 1/0 values for boolean fields."),
* stages = {
* "build" = 35
* }
......@@ -51,7 +51,7 @@ class BooleanItemProcessor extends ProcessorPluginBase implements BuildProcessor
'#title' => $this->t('On value'),
'#type' => 'textfield',
'#default_value' => !is_null($config) ? $config->getConfiguration()['on_value'] : $this->defaultConfiguration()['on_value'],
'#description' => $this->t('Set the display value for "On" facet result.'),
'#description' => $this->t('Use this label instead of <em>0</em> for the <em>On</em> or <em>True</em> value.'),
'#states' => [
'required' => ['input[name="facet_settings[boolean_item][status]"' => ['checked' => TRUE]],
],
......@@ -61,7 +61,7 @@ class BooleanItemProcessor extends ProcessorPluginBase implements BuildProcessor
'#title' => $this->t('Off value'),
'#type' => 'textfield',
'#default_value' => !is_null($config) ? $config->getConfiguration()['off_value'] : $this->defaultConfiguration()['off_value'],
'#description' => $this->t('Set the display value for "Off" facet result.'),
'#description' => $this->t('Use this label instead of <em>1</em> for the <em>Off</em> or <em>False</em> value.'),
'#states' => [
'required' => ['input[name="facet_settings[boolean_item][status]"' => ['checked' => TRUE]],
],
......
......@@ -13,7 +13,7 @@ use Drupal\facets\Processor\ProcessorPluginBase;
* @FacetsProcessor(
* id = "count_limit",
* label = @Translation("Count limit"),
* description = @Translation("Show or hide facets with based on item count."),
* description = @Translation("Show or hide depending on the number of results."),
* stages = {
* "build" = 50
* }
......
......@@ -16,8 +16,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @FacetsProcessor(
* id = "dependent_processor",
* label = @Translation("Dependent Facet"),
* description = @Translation("Make this facet depend on the state of another facet."),
* label = @Translation("Dependent facet"),
* description = @Translation("Display this facet depending on the state of another facet."),
* stages = {
* "build" = 5
* }
......@@ -110,9 +110,9 @@ class DependentFacetProcessor extends ProcessorPluginBase implements BuildProces
'#title' => $this->t('Condition mode'),
'#type' => 'radios',
'#options' => [
'presence' => $this->t('Check for facet being present'),
'not_empty' => $this->t('Check for facet being selected / not empty'),
'values' => $this->t('Check for facet being set to specific values'),
'presence' => $this->t('Check whether the facet is present.'),
'not_empty' => $this->t('Check whether the facet is selected / not empty.'),
'values' => $this->t('Check whether the facet is set to specific values.'),
],
'#default_value' => empty($config[$facet->id()]['condition']) ? NULL : $config[$facet->id()]['condition'],
'#states' => [
......
......@@ -13,7 +13,7 @@ use Drupal\facets\Processor\ProcessorPluginBase;
* @FacetsProcessor(
* id = "exclude_specified_items",
* label = @Translation("Exclude specified items"),
* description = @Translation("Excludes items by node id or title."),
* description = @Translation("Exclude items depending on their raw or display value (such as node IDs or titles)."),
* stages = {
* "build" = 50
* }
......
......@@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @FacetsProcessor(
* id = "list_item",
* label = @Translation("List item label"),
* description = @Translation("Fields that are a list (such as list (integer), list (text)) or a bundle field can use this processor to show the value instead of the key."),
* description = @Translation("Display the label instead of the key of fields that are a list (such as <em>List (integer)</em>) or <em>List (text)</em>) or a bundle field."),
* stages = {
* "build" = 5
* }
......
......@@ -17,8 +17,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @FacetsProcessor(
* id = "translate_entity",
* label = @Translation("Transform entity id into label"),
* description = @Translation("Show entity label instead of entity id. E.g. for a taxonomy term id, show the term name instead"),
* label = @Translation("Transform entity ID to label"),
* description = @Translation("Display the entity label instead of its ID (for example the term name instead of the taxonomy term ID)."),
* stages = {
* "build" = 5
* }
......
......@@ -12,8 +12,8 @@ use Drupal\user\Entity\User;
*
* @FacetsProcessor(
* id = "uid_to_username_callback",
* label = @Translation("Transform uid to username"),
* description = @Translation("Show the username instead, when the source field is a user id."),
* label = @Translation("Transform UID to user name"),
* description = @Translation("Display the user name if the source field is a user ID."),
* stages = {
* "build" = 5
* }
......
......@@ -19,7 +19,7 @@ use Drupal\facets\Processor\ProcessorPluginBase;
* @FacetsProcessor(
* id = "url_processor_handler",
* label = @Translation("URL handler"),
* description = @Translation("Triggers the URL processor, which is set in the Facet source configuration."),
* description = @Translation("Trigger the URL processor, which is set in the facet source configuration."),
* stages = {
* "pre_query" = 50,
* "build" = 15,
......
......@@ -43,7 +43,7 @@ class DropdownWidget extends WidgetPluginBase {
public function buildConfigurationForm(array $form, FormStateInterface $form_state, FacetInterface $facet) {
$config = $this->getConfiguration();
$message = $this->t('This widget requires "Make sure only one result can be shown." to be enabled to behave as a standard dropdown.');
$message = $this->t('To achieve the standard behavior of a dropdown, you need to enable the facet setting below <em>"Ensure that only one result can be displayed"</em>.');
$form['warning'] = [
'#markup' => '<div class="messages messages--warning">' . $message . '</div>',
];
......
......@@ -52,7 +52,7 @@ class LinksWidget extends WidgetPluginBase {
'#title' => $this->t('Soft limit'),
'#default_value' => $this->getConfiguration()['soft_limit'],
'#options' => [0 => $this->t('No limit')] + array_combine($options, $options),
'#description' => $this->t('Limits the number of displayed facets via JavaScript.'),
'#description' => $this->t('Limit the number of displayed facets via JavaScript.'),
];
return $form;
}
......
......@@ -386,7 +386,7 @@ class IntegrationTest extends FacetsTestBase {
'facet_settings[url_alias]' => 'alias' . $unwanted_value . '1',
];
$this->drupalPostForm(NULL, $form_values, 'Save');
$this->assertText('Url alias has illegal characters.');
$this->assertText('The URL alias contains characters that are not allowed.');
}
// Post an alias with allowed values.
......
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