Browse Source

Merge branch '8.x-1.x' into issue-419

pull/756/head
Danny Lamb 8 years ago
parent
commit
82742182cb
  1. 2
      config/install/islandora.settings.yml
  2. 21
      islandora.links.menu.yml
  3. 5
      islandora.links.task.yml
  4. 20
      islandora.routing.yml
  5. 2
      src/Entity/FedoraResource.php
  6. 72
      src/Form/IslandoraSettingsForm.php

2
config/install/islandora.settings.yml

@ -0,0 +1,2 @@
broker_url: 'http://localhost:61613'
triplestore_index_queue: '/islandora/triplestore/index'

21
islandora.links.menu.yml

@ -1,11 +1,3 @@
# Fedora resource menu items definition
entity.fedora_resource.collection:
title: 'Fedora resource list'
route_name: entity.fedora_resource.collection
description: 'List Fedora resource entities'
parent: system.admin_structure
weight: 100
# Fedora resource type menu items definition
entity.fedora_resource_type.collection:
title: 'Fedora resource type list'
@ -14,3 +6,16 @@ entity.fedora_resource_type.collection:
parent: system.admin_structure
weight: 99
# Menu list of Islandora configuration forms
system.admin_config_islandora:
title: Islandora
parent: system.admin_config
route_name: system.admin_config_islandora
weight: 100
# Core Islandora configuration form
system.islandora_settings:
title: 'Core Settings'
parent: system.admin_config_islandora
route_name: system.islandora_settings
description: 'Confgure core Islandora settings'

5
islandora.links.task.yml

@ -14,3 +14,8 @@ entity.fedora_resource.delete_form:
base_route: entity.fedora_resource.canonical
title: Delete
weight: 10
entity.fedora_resource.collection:
route_name: entity.fedora_resource.collection
base_route: system.admin_content
title: 'Fedora Resources'

20
islandora.routing.yml

@ -9,4 +9,22 @@ entity.fedora_resource_type.rdftest:
options:
parameters:
node_preview:
type: 'node_preview'
type: 'node_preview'
# Menu list of Islandora configuration forms
system.admin_config_islandora:
path: '/admin/config/islandora'
defaults:
_controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
_title: 'Islandora'
requirements:
_permission: 'access administration pages'
# Core Islandora configuration form
system.islandora_settings:
path: '/admin/config/islandora/core'
defaults:
_form: '\Drupal\islandora\Form\IslandoraSettingsForm'
_title: 'Islandora Settings'
requirements:
_permission: 'administer site configuration'

2
src/Entity/FedoraResource.php

@ -59,7 +59,7 @@ use Drupal\user\UserInterface;
* "add-form" = "/fedora_resource/add/{fedora_resource_type}",
* "edit-form" = "/fedora_resource/{fedora_resource}/edit",
* "delete-form" = "/fedora_resource/{fedora_resource}/delete",
* "collection" = "/admin/structure/fedora_resource",
* "collection" = "/admin/content/fedora_resource",
* },
* bundle_entity_type = "fedora_resource_type",
* field_ui_base_route = "entity.fedora_resource_type.edit_form"

72
src/Form/IslandoraSettingsForm.php

@ -0,0 +1,72 @@
<?php
/**
* @file
* Settings form for Islandora.
*/
namespace Drupal\islandora\Form;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Config form for Islandora settings.
*/
class IslandoraSettingsForm extends ConfigFormBase {
const CONFIG_NAME = 'islandora.settings';
const BROKER_URL = 'broker_url';
const TRIPLESTORE_INDEX_QUEUE = 'triplestore_index_queue';
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'islandora_admin_settings';
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return [
self::CONFIG_NAME,
];
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config(self::CONFIG_NAME);
$form[self::BROKER_URL] = array(
'#type' => 'textfield',
'#title' => $this->t('Broker URL'),
'#default_value' => $config->get(self::BROKER_URL),
);
$form[self::TRIPLESTORE_INDEX_QUEUE] = array(
'#type' => 'textfield',
'#title' => $this->t('Triplestore Index Queue'),
'#default_value' => $config->get(self::TRIPLESTORE_INDEX_QUEUE),
);
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = \Drupal::service('config.factory')->getEditable(self::CONFIG_NAME);
$config
->set(self::BROKER_URL, $form_state->getValue(self::BROKER_URL))
->set(self::TRIPLESTORE_INDEX_QUEUE, $form_state->getValue(self::TRIPLESTORE_INDEX_QUEUE))
->save();
parent::submitForm($form, $form_state);
}
}
Loading…
Cancel
Save