N°2847 - Rework iTopWebPage layout (WIP Part VI)

- iTopWebPage: Restore "open search" feature
- iTopWebPage: Change all resources URL to absolute in order to benefit from the "duplicate removal" benefits
- iTopWebPage: Remove obsolete method IsMenuPaneVisible()
- Config: Add new parameters quick_create.enabled / global_search.enabled / breadcrumb.enabled
- utils: Add new GetAppRevisionNumber() method
- Introduce iUIBlock interface for UI layouts, components, ...
- Introduce BlockRenderer to properly render blocks
- Add "render_block" function to TwigHelper to render blocks directly from TWIG
- Refactor layouts and components into proper block classes to fit the new architecture
This commit is contained in:
Molkobain
2020-07-29 18:43:31 +02:00
parent b207ae1bb3
commit 1f0211b45a
43 changed files with 2537 additions and 335 deletions

View File

@@ -8,6 +8,8 @@ namespace Combodo\iTop\Application\TwigBase\Twig;
use AttributeDateTime;
use Combodo\iTop\Application\UI\iUIBlock;
use Combodo\iTop\Renderer\BlockRenderer;
use Dict;
use Exception;
use MetaModel;
@@ -144,6 +146,13 @@ class Extension
$oTwigEnv->addFunction(new Twig_SimpleFunction('get_absolute_url_modules_root', function () {
return utils::GetAbsoluteUrlModulesRoot();
}));
// Function to render a UI block (HTML, inline CSS, inline JS) and its sub blocks directly in the TWIG
// Usage in twig: {{ render_block(oBlock) }}
/** @since 2.8.0 */
$oTwigEnv->addFunction(new Twig_SimpleFunction('render_block', function(iUIBlock $oBlock){
return BlockRenderer::RenderBlockTemplates($oBlock);
}, ['is_safe' => ['html']]));
}
}