Custom blocks name doesn't show up in OJS 3.0.1

Tags: #<Tag:0x007f4148051f50> #<Tag:0x007f4148051de8>


I am working on OJS 3.0.1 in spanish and when i create a custom block, it doesn’t show the title so I modified getContents function at this file plugins/generic/customBlockManager/ into:

function getContents(&$templateMgr, $request = null) {
// Ensure that we’re dealing with a request with context
$context = $request->getContext();
if (!$context) return ‘’;

            // Get the block contents.
            $customBlockName = $this->getName();
            $customBlockContent = $this->getSetting($context->getId(), 'blockContent');
            $currentLocale = AppLocale::getLocale();
            $divCustomBlockId = 'customblock-'.preg_replace('/\W+/', '-', $this->getName());
            $templateMgr->assign('customBlockId', $divCustomBlockId);
            $templateMgr->assign('customBlockContent', $customBlockContent[$currentLocale]);
            $templateMgr->assign('customBlockName', $customBlockName);
            return parent::getContents($templateMgr, $request);

I added customBlockName variable to use it in plugins/generic/customBlockManager/block.tpl file:

> <div class="pkp_block block_custom" id="{$customBlockId|escape}">
>         <span class="title">
>                 {$customBlockName}
>         </span>
>         <div class="content">
>                 {$customBlockContent}
>         </div>
> </div>

this way I could show title in the custom block.



Hi @edycop,

Do you mean the custom block name? That’s not intended for display – but if you find this modification useful, please continue with it! Thanks for sharing; others may find it useful too.

Alec Smecher
Public Knowledge Project Team


Thanks a lot for this piece of coding for reflecting titles of the custom blocks


@varshilmehta and @edycop
May I know what coding modification was done in custom block plugin at your website so as to have custom block title with space/punctuation marks/special characters


Thank you very much @edycop … this information was very useful.
I needed to add an accordion in the titles of the sidebar but I did not have how to do it to the content that came from the custom blocks … and thanks to this information I was able to implement it …

Thank you very much…

@asmecher Is there any limitation or obstacle so that is not so? … I think the idea that the name of the block is the one given in the form is very good when that block is created.

Thank you again for all the help and great work in OJS 3!


Hi @David_Alarcon_davidy,

See for some discussion of the custom block title.

Alec Smecher
Public Knowledge Project Team