Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
add block fixes and hook for scribite use
Browse files Browse the repository at this point in the history
  • Loading branch information
craigh committed Jul 23, 2020
1 parent 4e660e0 commit 6b4349a
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 22 deletions.
5 changes: 0 additions & 5 deletions Block/Form/Type/FincludeBlockType.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
;
}

public function getBlockPrefix()
{
return 'zikulablocksmodule_fincludeblock';
}

public function configureOptions(OptionsResolver $resolver)
{
// add a constraint to the entire form
Expand Down
5 changes: 0 additions & 5 deletions Block/Form/Type/HtmlBlockType.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,4 @@ public function buildForm(FormBuilderInterface $builder, array $options)
])
;
}

public function getBlockPrefix()
{
return 'zikulablocksmodule_htmlblock';
}
}
5 changes: 0 additions & 5 deletions Block/Form/Type/TextBlockType.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,4 @@ static function($submittedDescription) {
))
;
}

public function getBlockPrefix()
{
return 'zikulablocksmodule_textblock';
}
}
5 changes: 0 additions & 5 deletions Block/Form/Type/XsltBlockType.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ public function configureOptions(OptionsResolver $resolver)
]);
}

public function getBlockPrefix()
{
return 'zikulablocksmodule_xsltblock';
}

/**
* Validation method for entire form.
*/
Expand Down
60 changes: 60 additions & 0 deletions HookSubscriber/UiHooksSubscriber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

declare(strict_types=1);

/*
* This file is part of the ZikulaModules\StaticContentModule package.
*
* Copyright Zikula - https://ziku.la/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Zikula\StaticContentModule\HookSubscriber;

use Symfony\Contracts\Translation\TranslatorInterface;
use Zikula\Bundle\HookBundle\Category\UiHooksCategory;
use Zikula\Bundle\HookBundle\HookSubscriberInterface;

class UiHooksSubscriber implements HookSubscriberInterface
{
public const HTMLBLOCK_EDIT_FORM = 'staticcontent.ui_hooks.htmlblock.content.form_edit';

/**
* @var TranslatorInterface
*/
private $translator;

public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}

public function getOwner(): string
{
return 'ZikulaStaticContentModule';
}

public function getCategory(): string
{
return UiHooksCategory::NAME;
}

public function getTitle(): string
{
return $this->translator->trans('HTML Block content hook');
}

public function getAreaName(): string
{
return 'subscriber.staticcontentmodule.ui_hooks.htmlblock_content';
}

public function getEvents(): array
{
return [
UiHooksCategory::TYPE_FORM_EDIT => self::HTMLBLOCK_EDIT_FORM
];
}
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ as restricted as the use above for full page display. Other blocks are documente

In Core 3.0.1 you can use the Routes module to create a custom route to the template. So, instead of `/p/foo` you could
use simply `/foo` or `/smile` or anything you like.

## Changelog
#### 1.0.1
- added hook for html block
2 changes: 1 addition & 1 deletion Resources/views/Block/html_modify.html.twig
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{ form_widget(form) }}
{{ notifyDisplayHooks(constant('Zikula\\BlocksModule\\HookSubscriber\\UiHooksSubscriber::HTMLBLOCK_EDIT_FORM'), form.vars.value.bid|default(null)) }}
{{ notifyDisplayHooks(constant('Zikula\\StaticContentModule\\HookSubscriber\\UiHooksSubscriber::HTMLBLOCK_EDIT_FORM'), form.vars.value.bid|default(null)) }}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zikula/staticcontent-module",
"version": "1.0.0",
"version": "1.0.1",
"description": "Display static content simply.",
"type": "zikula-module",
"license": "MIT",
Expand Down

0 comments on commit 6b4349a

Please sign in to comment.