Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/acdh-oeaw/arche-gui
Browse files Browse the repository at this point in the history
  • Loading branch information
nczirjak-acdh committed Oct 2, 2020
2 parents a017336 + 7fb51dd commit ff63283
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/Controller/SearchViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ public function fulltext_search(string $metavalue = "root", string $limit = "10"
);

$guiData = array('data' => $this->helper->createView($data['data']), 'pagination' => $pagination);
} else {
} else {
$guiData['data'] = array();
$guiData['pagination'] = $this->pagingHelper->createView(
array(
'limit' => $limit, 'page' => $page, 'order' => $order,
'numPage' => 1, 'sum' => 0
)
);
}
}

return [
'#theme' => 'acdh-repo-gui-search-full',
Expand Down
30 changes: 18 additions & 12 deletions src/Form/ComplexSearchForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Drupal\acdh_repo_gui\Model\BlocksModel;
use Drupal\acdh_repo_gui\Helper\FormHelper;

class ComplexSearchForm extends FormBase {

class ComplexSearchForm extends FormBase
{
private $langConf;
private $model;
private $helper;
Expand All @@ -18,7 +18,8 @@ class ComplexSearchForm extends FormBase {
/**
* Set up necessary properties
*/
public function __construct() {
public function __construct()
{
$this->langConf = $this->config('arche.settings');
$this->model = new BlocksModel();
$this->helper = new FormHelper();
Expand All @@ -28,7 +29,8 @@ public function __construct() {
* Set up the form id
* @return string
*/
public function getFormId() {
public function getFormId()
{
return "sks_form";
}

Expand All @@ -38,7 +40,8 @@ public function getFormId() {
* @param FormStateInterface $form_state
* @return array
*/
public function buildForm(array $form, FormStateInterface $form_state) {
public function buildForm(array $form, FormStateInterface $form_state)
{
//the input field
$this->createSearchInput($form);

Expand Down Expand Up @@ -76,7 +79,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
* @param array $form
* @param FormStateInterface $form_state
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
public function validateForm(array &$form, FormStateInterface $form_state)
{
$metavalue = $form_state->getValue('metavalue');
$types = $form_state->getValue('searchbox_types');
if (count($types) > 0) {
Expand All @@ -99,7 +103,8 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
* @param array $form
* @param FormStateInterface $form_state
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
public function submitForm(array &$form, FormStateInterface $form_state)
{
$metavalue = $form_state->getValue('metavalue');

$extras = array();
Expand Down Expand Up @@ -127,8 +132,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) {

$metaVal = urlencode($metavalue);
$form_state->setRedirect(
'repo_complexsearch',
[
'repo_complexsearch',
[
"metavalue" => $metaVal,
"order" => "datedesc",
"limit" => "10",
Expand All @@ -142,7 +147,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
* @param array $form
* @param array $data
*/
private function createBox(array &$form, array $data) {
private function createBox(array &$form, array $data)
{
$form['search'][$data["type"]] = array(
'#type' => 'checkboxes',
'#title' => $this->t($data["title"]),
Expand All @@ -160,7 +166,8 @@ private function createBox(array &$form, array $data) {
* @param array $form
* @return array
*/
private function createSearchInput(array &$form) {
private function createSearchInput(array &$form)
{
$form['metavalue'] = array(
'#type' => 'textfield',
'#attributes' => array(
Expand All @@ -179,5 +186,4 @@ private function createSearchInput(array &$form) {
'#button_type' => 'primary',
);
}

}
7 changes: 4 additions & 3 deletions src/Model/SearchViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ public function __construct()
(isset($this->repo->getSchema()->__get('namespaces')->ontology)) ? $this->namespace = $this->repo->getSchema()->__get('namespaces')->ontology : $this->namespace = 'https://vocabs.acdh.oeaw.ac.at/schema#';
}

private function setUpPayload(): void {
if(isset($this->metaObj->payload)) {
private function setUpPayload(): void
{
if (isset($this->metaObj->payload)) {
$this->binarySearch = $this->metaObj->payload;
}
}

/**
* Full content search
*
*
* @param int $limit
* @param int $page
* @param string $order
Expand Down

0 comments on commit ff63283

Please sign in to comment.