Fixes for the error which phpcbf can't fix
This commit is contained in:
parent
0940670323
commit
d1692db53a
7 changed files with 57 additions and 35 deletions
|
|
@ -104,9 +104,10 @@ class AdvancedSearchForm extends FormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get if Edismax Search checkbox is enabled or disable.
|
||||
* Get if Search All Fields checkbox is enabled or disable.
|
||||
*
|
||||
* @return bool
|
||||
* the enable or disable for Search All Fields checkbox
|
||||
*/
|
||||
public static function getSearchAllFields() {
|
||||
return self::getConfig(SettingsForm::SEARCH_ALL_FIELDS_FLAG, 0);
|
||||
|
|
@ -116,6 +117,7 @@ class AdvancedSearchForm extends FormBase {
|
|||
* Get if Edismax Search checkbox is enabled or disable.
|
||||
*
|
||||
* @return bool
|
||||
* the enable or disable for Edismax Search checkbox
|
||||
*/
|
||||
public static function getEdismaxSearch() {
|
||||
return self::getConfig(SettingsForm::EDISMAX_SEARCH_FLAG, 0);
|
||||
|
|
@ -271,7 +273,7 @@ class AdvancedSearchForm extends FormBase {
|
|||
],
|
||||
];
|
||||
|
||||
$options = (self::getEdismaxSearch() && self::getSearchAllFields()) ? ["all" => $this->t(self::getEdismaxSearchLabel())] + $this->fieldOptions($fields) : $this->fieldOptions($fields);
|
||||
$options = (self::getEdismaxSearch() && self::getSearchAllFields()) ? ["all" => $this->t("@", self::getEdismaxSearchLabel())] + $this->fieldOptions($fields) : $this->fieldOptions($fields);
|
||||
$term_default_values = $this->defaultTermValues($options);
|
||||
[$recursive, $term_values] = $this->processInput($form_state, $term_default_values);
|
||||
$i = 0;
|
||||
|
|
|
|||
|
|
@ -8,30 +8,45 @@ use Drupal\Core\Form\FormStateInterface;
|
|||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
*
|
||||
* Form for building and Simple Search.
|
||||
*/
|
||||
class SearchForm extends FormBase {
|
||||
protected $block_id;
|
||||
|
||||
/**
|
||||
* @param $block_id
|
||||
* The Block ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $blockId;
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
*
|
||||
* @param string $block_id
|
||||
* Passing the block_id.
|
||||
*/
|
||||
public function __construct($block_id) {
|
||||
$this->block_id = $block_id;
|
||||
$this->blockId = $block_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Block Id.
|
||||
*
|
||||
* @return mixed
|
||||
* Return the Block ID
|
||||
*/
|
||||
public function getBlockId() {
|
||||
return $this->block_id;
|
||||
return $this->blockId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $block_id
|
||||
* Set Block ID.
|
||||
*
|
||||
* @param mixed $blockId
|
||||
* Set the block ID.
|
||||
*/
|
||||
public function setBlockId($block_id): void {
|
||||
$this->block_id = $block_id;
|
||||
public function setBlockId($blockId): void {
|
||||
$this->blockId = $blockId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -51,12 +66,12 @@ class SearchForm extends FormBase {
|
|||
$form['search-attributes'][SettingsForm::SEARCH_ALL_FIELDS_FLAG] = [
|
||||
'#markup' => $this
|
||||
->t('<strong>This block is required to enable searching all fields for the Advanced Search.
|
||||
To proceed, please enable the Search All fields in
|
||||
To proceed, please enable the Search All fields in
|
||||
<a href="/admin/config/search/advanced" target="_blank">Advanced Seach Configuration</a></strong>.'),
|
||||
];
|
||||
}
|
||||
else {
|
||||
$block = Block::load($this->block_id);
|
||||
$block = Block::load($this->blockId);
|
||||
|
||||
if ($block) {
|
||||
$settings = $block->get('settings');
|
||||
|
|
@ -67,8 +82,8 @@ class SearchForm extends FormBase {
|
|||
'#type' => 'textfield',
|
||||
'#title' => (!empty($settings['search_textfield_label']) ? $settings['search_textfield_label'] : ''),
|
||||
'#attributes' => [
|
||||
'placeholder' => isset($settings['search_placeholder']) ? $this->t($settings['search_placeholder']) : $this->t("Search collections"),
|
||||
'aria-label' => (isset($settings['search_textfield_label']) ? $this->t($settings['search_textfield_label']) : $this->t('Enter Keyword')),
|
||||
'placeholder' => isset($settings['search_placeholder']) ? $this->t("@", $settings['search_placeholder']) : $this->t("Search collections"),
|
||||
'aria-label' => (isset($settings['search_textfield_label']) ? $this->t("@", $settings['search_textfield_label']) : $this->t('Enter Keyword')),
|
||||
],
|
||||
'#theme_wrappers' => [],
|
||||
];
|
||||
|
|
@ -88,7 +103,7 @@ class SearchForm extends FormBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
$block = Block::load($this->block_id);
|
||||
$block = Block::load($this->blockId);
|
||||
if ($block) {
|
||||
$settings = $block->get('settings');
|
||||
$view_machine_name = $settings['search_view_machine_name'];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue