Commit 7cba3885 authored by schmook's avatar schmook Committed by vuil

Issue #3106974 by schmook, vuil, laughnan: Adding Block Level Juicer Username

parent 247484d0
......@@ -89,6 +89,14 @@ class JuicerEmbedFeedBlock extends BlockBase implements BlockPluginInterface, Co
'#title' => 'Juicer Feed Settings',
];
// Set the Juicer ID at the block level.
$form['juicer'][$delta . '_feed_id'] = [
'#type' => 'textfield',
'#title' => t('Juicer Username Override'),
'#default_value' => isset($config[$delta . '_feed_id']) ? $config[$delta . '_feed_id'] : '',
'#description' => t('Enter a block level Juicer username. If left blank the default will be taken from the global username.'),
];
// Feed style.
$form['juicer'][$delta . '_style'] = [
'#type' => 'select',
......@@ -156,6 +164,7 @@ class JuicerEmbedFeedBlock extends BlockBase implements BlockPluginInterface, Co
parent::blockSubmit($form, $form_state);
$values = $form_state->getValues();
$delta = $this->getDerivativeId();
$this->configuration[$delta . '_feed_id'] = $values['juicer'][$delta . '_feed_id'];
$this->configuration[$delta . '_post_number'] = $values['juicer'][$delta . '_post_number'];
$this->configuration[$delta . '_infinite_pages'] = $values['juicer'][$delta . '_infinite_pages'];
$this->configuration[$delta . '_gutter_amt'] = $values['juicer'][$delta . '_gutter_amt'];
......@@ -169,7 +178,12 @@ class JuicerEmbedFeedBlock extends BlockBase implements BlockPluginInterface, Co
*/
public function build() {
$delta = $this->getDerivativeId();
$juicer_feed_id = $this->configFactory->get('juicerio.settings')->get('juicer_feed_id');
if ($this->configuration[$delta . '_feed_id']) {
$juicer_feed_id = $this->configuration[$delta . '_feed_id'];
}
else {
$juicer_feed_id = \Drupal::config('juicerio.settings')->get('juicer_feed_id');
}
// Permit the alternative JS library to be attached here [#2917855].
$juicer_library = $this->configFactory->get('juicerio.settings')->get('juicer_js_embed');
......
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