-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'dgi/8.x-2.x' into move-base
- Loading branch information
Showing
14 changed files
with
530 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
'administer islandora_spreadsheet_ingest requests': | ||
title: 'Administer requests' | ||
'create islandora_spreadsheet_ingest requests': | ||
title: 'Create request' | ||
'edit islandora_spreadsheet_ingest requests': | ||
title: 'Edit request' | ||
'edit islandora_spreadsheet_ingest request mapping': | ||
title: 'Edit request mapping' | ||
'view islandora_spreadsheet_ingest requests': | ||
title: 'View requests' | ||
'activate islandora_spreadsheet_ingest requests': | ||
title: 'Activate requests' | ||
'deleta islandora_spreadsheet_ingest requests': | ||
title: 'Delete requests' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
namespace Drupal\islandora_spreadsheet_ingest\Form; | ||
|
||
use Drupal\Core\Config\ConfigFactoryInterface; | ||
use Drupal\Core\Form\ConfigFormBase; | ||
use Drupal\Core\Form\FormStateInterface; | ||
use Drupal\Core\StreamWrapper\StreamWrapperInterface; | ||
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
/** | ||
* Module settings form. | ||
*/ | ||
class Admin extends ConfigFormBase { | ||
|
||
/** | ||
* The StreamWrapperManager. | ||
* | ||
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface | ||
*/ | ||
protected $streamWrapperManager; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function __construct(ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager) { | ||
parent::__construct($config_factory); | ||
$this->streamWrapperManager = $stream_wrapper_manager; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static function create(ContainerInterface $container) { | ||
return new static( | ||
$container->get('config.factory'), | ||
$container->get('stream_wrapper_manager') | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFormId() { | ||
return 'islandora_spreadsheet_ingest_admin_settings_form'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildForm(array $form, FormStateInterface $form_state) { | ||
$form = []; | ||
$config = $this->config('islandora_spreadsheet_ingest.settings'); | ||
$current_whitelist = $config->get('binary_directory_whitelist'); | ||
$form['schemes'] = [ | ||
'#type' => 'checkboxes', | ||
'#title' => $this->t('Schemes'), | ||
'#description' => $this->t('Allowed list of schemes for which binaries can be referenced from.'), | ||
'#default_value' => $config->get('schemes') ?? [], | ||
'#options' => $this->streamWrapperManager->getNames(StreamWrapperInterface::READ_VISIBLE), | ||
]; | ||
$form['paths'] = [ | ||
'#type' => 'textarea', | ||
'#title' => $this->t('Binary path whitelist'), | ||
'#default_value' => $current_whitelist ? implode(',', $current_whitelist) : '', | ||
'#description' => $this->t('A comma separated list of local locations from which spreadsheet ingests can use binaries.'), | ||
]; | ||
$form['submit'] = [ | ||
'#type' => 'submit', | ||
'#value' => $this->t('Save'), | ||
]; | ||
|
||
return $form; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getEditableConfigNames() { | ||
return ['islandora_spreadsheet_ingest.settings']; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function submitForm(array &$form, FormStateInterface $form_state) { | ||
$config = $this->config('islandora_spreadsheet_ingest.settings'); | ||
$whitelist = explode(',', $form_state->getValue('paths')); | ||
$config->set('binary_directory_whitelist', $whitelist); | ||
$config->set('schemes', array_filter($form_state->getValue('schemes'))); | ||
$config->save(); | ||
parent::submitForm($form, $form_state); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.