Skip to content

Commit 8e5a96c

Browse files
committed
detailed UI hooks processing can be used in stable targets again now
1 parent 7c2ecb8 commit 8e5a96c

4 files changed

Lines changed: 24 additions & 40 deletions

File tree

bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/zclassic/view/Forms.xtend

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,12 @@ class Forms {
340340
341341
def private displayHooks(Entity it, Application app) '''
342342
{% set hookId = mode != 'create' ? «name.formatForDB».«primaryKey.name.formatForCode» : null %}
343-
«IF application.targets('2.0-dev') || (application.targets('1.5-dev') && !application.targets('2.0'))»
344-
{% set hooks = notifyDisplayHooks(eventName='«app.appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_edit', id=hookId, true) %}
345-
{% if hooks is iterable and hooks|length > 0 %}
346-
{% for area, hook in hooks %}
347-
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
348-
{% endfor %}
349-
{% endif %}
350-
«ELSE»
351-
{{ notifyDisplayHooks(eventName='«app.appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_edit', id=hookId) }}
352-
«ENDIF»
343+
{% set hooks = notifyDisplayHooks(eventName='«app.appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_edit', id=hookId, true) %}
344+
{% if hooks is iterable and hooks|length > 0 %}
345+
{% for area, hook in hooks %}
346+
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
347+
{% endfor %}
348+
{% endif %}
353349
'''
354350
355351
def private additionalInitScript(DerivedField it) {

bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/zclassic/view/pages/Delete.xtend

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,11 @@ class Delete {
8585
'''
8686
8787
def private callDisplayHooks(Entity it, String appName) '''
88-
«IF application.targets('2.0-dev') || (application.targets('1.5-dev') && !application.targets('2.0'))»
89-
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_delete', id=«name.formatForCode».getKey(), true) %}
90-
{% if hooks is iterable and hooks|length > 0 %}
91-
{% for area, hook in hooks %}
92-
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
93-
{% endfor %}
94-
{% endif %}
95-
«ELSE»
96-
{{ notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_delete', id=«name.formatForCode».getKey()) }}
97-
«ENDIF»
88+
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_delete', id=«name.formatForCode».getKey(), true) %}
89+
{% if hooks is iterable and hooks|length > 0 %}
90+
{% for area, hook in hooks %}
91+
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
92+
{% endfor %}
93+
{% endif %}
9894
'''
9995
}

bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/zclassic/view/pages/Display.xtend

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,12 @@ class Display {
329329
<div role="tabpanel" class="tab-pane fade" id="tabHooks" aria-labelledby="hooksTab">
330330
<h3>{{ __('Hooks') }}</h3>
331331
«ENDIF»
332-
«IF application.targets('2.0-dev') || (application.targets('1.5-dev') && !application.targets('2.0'))»
333-
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', id=«name.formatForCode».getKey(), urlObject=currentUrlObject, true) %}
334-
{% if hooks is iterable and hooks|length > 0 %}
335-
{% for area, hook in hooks %}
336-
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
337-
{% endfor %}
338-
{% endif %}
339-
«ELSE»
340-
{{ notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', id=«name.formatForCode».getKey(), urlObject=currentUrlObject) }}
341-
«ENDIF»
332+
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', id=«name.formatForCode».getKey(), urlObject=currentUrlObject, true) %}
333+
{% if hooks is iterable and hooks|length > 0 %}
334+
{% for area, hook in hooks %}
335+
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
336+
{% endfor %}
337+
{% endif %}
342338
«IF useGroupingTabs('display'
343339
</div>
344340
«ENDIF»

bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/zclassic/view/pages/View.xtend

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -338,16 +338,12 @@ class View {
338338
339339
{# here you can activate calling display hooks for the view page if you need it #}
340340
{# % if routeArea != 'admin' %}
341-
«IF application.targets('2.0-dev') || (application.targets('1.5-dev') && !application.targets('2.0'))»
342-
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', urlObject=currentUrlObject, true) %}
343-
{% if hooks is iterable and hooks|length > 0 %}
344-
{% for area, hook in hooks %}
345-
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
346-
{% endfor %}
347-
{% endif %}
348-
«ELSE»
349-
{{ notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', urlObject=currentUrlObject) }}
350-
«ENDIF»
341+
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', urlObject=currentUrlObject, true) %}
342+
{% if hooks is iterable and hooks|length > 0 %}
343+
{% for area, hook in hooks %}
344+
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
345+
{% endfor %}
346+
{% endif %}
351347
{% endif % #}
352348
'''
353349

0 commit comments

Comments
 (0)