Skip to content

Commit

Permalink
Merge pull request #86 from jonasraoni/feature-main-8333-add-remainin…
Browse files Browse the repository at this point in the history
…g-fks

Feature main 8333 add remaining fks
  • Loading branch information
jonasraoni authored Jul 24, 2024
2 parents 07a2037 + 555a188 commit 9d92d83
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CustomBlockManagerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function register($category, $path, $mainContextId = null)
$contextId = $mainContextId;
} else {
$context = $request->getContext();
$contextId = $context?->getId() ?? \PKP\core\PKPApplication::CONTEXT_SITE;
$contextId = $context?->getId() ?? \PKP\core\PKPApplication::SITE_CONTEXT_ID;
}

// Load the custom blocks we have created
Expand Down
2 changes: 1 addition & 1 deletion CustomBlockPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function getDescription()
public function getContents($templateMgr, $request = null)
{
$context = $request->getContext();
$contextId = $context ? $context->getId() : 0;
$contextId = $context ? $context->getId() : Application::SITE_CONTEXT_ID;

// Get the block contents.
$customBlockTitle = $this->getSetting($contextId, 'blockTitle');
Expand Down
9 changes: 5 additions & 4 deletions controllers/grid/CustomBlockGridHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace APP\plugins\generic\customBlockManager\controllers\grid;

use APP\core\Application;
use APP\plugins\generic\customBlockManager\controllers\grid\form\CustomBlockForm;
use APP\plugins\generic\customBlockManager\CustomBlockManagerPlugin;
use APP\plugins\generic\customBlockManager\CustomBlockPlugin;
Expand Down Expand Up @@ -77,7 +78,7 @@ public function initialize($request, $args = null)
{
parent::initialize($request, $args);
$context = $request->getContext();
$contextId = $context ? $context->getId() : 0;
$contextId = $context ? $context->getId() : Application::SITE_CONTEXT_ID;

// Set the grid title.
$this->setTitle('plugins.generic.customBlockManager.customBlocks');
Expand Down Expand Up @@ -162,7 +163,7 @@ public function editCustomBlock($args, $request)
{
$blockName = $request->getUserVar('blockName');
$context = $request->getContext();
$contextId = $context ? $context->getId() : 0;
$contextId = $context ? $context->getId() : Application::SITE_CONTEXT_ID;
$this->setupTemplate($request);

$customBlockPlugin = null;
Expand Down Expand Up @@ -192,7 +193,7 @@ public function updateCustomBlock($args, $request)
{
$pluginName = $request->getUserVar('existingBlockName');
$context = $request->getContext();
$contextId = $context ? $context->getId() : 0;
$contextId = $context ? $context->getId() : Application::SITE_CONTEXT_ID;
$this->setupTemplate($request);

$customBlockPlugin = null;
Expand Down Expand Up @@ -232,7 +233,7 @@ public function deleteCustomBlock($args, $request)

$blockName = $request->getUserVar('blockName');
$context = $request->getContext();
$contextId = $context ? $context->getId() : 0;
$contextId = $context ? $context->getId() : Application::SITE_CONTEXT_ID;

// Delete all the entries for this block plugin
/** @var PluginSettingsDAO */
Expand Down
4 changes: 2 additions & 2 deletions controllers/grid/form/CustomBlockForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class CustomBlockForm extends Form
{
/** @var int Context (press / journal) ID */
/** @var ?int Context (press / journal) ID */
public $contextId;

/** @var CustomBlockPlugin Custom block plugin */
Expand All @@ -36,7 +36,7 @@ class CustomBlockForm extends Form
* Constructor
*
* @param string $template the path to the form template file
* @param int $contextId
* @param ?int $contextId
* @param CustomBlockPlugin $plugin
*/
public function __construct($template, $contextId, $plugin = null)
Expand Down

0 comments on commit 9d92d83

Please sign in to comment.