mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
FAF: Documentation UI Twig Blocks
This commit is contained in:
@@ -8,6 +8,7 @@ namespace Combodo\iTop\Documentation\UI;
|
||||
|
||||
use Exception;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
use ReflectionMethod;
|
||||
use ReflectionNamedType;
|
||||
use utils;
|
||||
@@ -265,6 +266,45 @@ function GetMethodParameters(ReflectionMethod $oMethod, string $sFullComment): a
|
||||
return $aDocParams;
|
||||
}
|
||||
|
||||
function GetMethodComment(ReflectionMethod $oMethod, string $sParamName)
|
||||
{
|
||||
$sComment = $oMethod->getDocComment();
|
||||
if (strpos($sComment, $sParamName) !== false) {
|
||||
return $sComment;
|
||||
}
|
||||
|
||||
//echo "- comment for $sParamName not found in ".$oMethod->class.":".$oMethod->name."\n";
|
||||
|
||||
// Try to find the comment in the parent class
|
||||
$oReflectionClass = new ReflectionClass($oMethod->class);
|
||||
$oReflectionParentClass = $oReflectionClass->getParentClass();
|
||||
if ($oReflectionParentClass === false) {
|
||||
$aReflectionParentClasses = $oReflectionClass->getInterfaces();
|
||||
foreach ($aReflectionParentClasses as $oReflectionParentClass) {
|
||||
try {
|
||||
$oParentMethod = $oReflectionParentClass->getMethod($oMethod->name);
|
||||
}
|
||||
catch (ReflectionException $e) {
|
||||
continue;
|
||||
}
|
||||
$sComment = GetMethodComment($oParentMethod, $sParamName);
|
||||
if (!empty($sComment)) {
|
||||
return $sComment;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
try {
|
||||
$oParentMethod = $oReflectionParentClass->getMethod($oMethod->name);
|
||||
}
|
||||
catch (ReflectionException $e) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return GetMethodComment($oParentMethod, $sParamName);
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
/// Main
|
||||
///
|
||||
@@ -332,7 +372,10 @@ foreach ($aFactoryClasses as $sFactoryClass) {
|
||||
$sName = $oMethod->getName();
|
||||
}
|
||||
if (!empty($sName)) {
|
||||
$sFullComment = $oMethod->getDocComment();
|
||||
// Get the param name
|
||||
$aReflectionParameters = $oMethod->getParameters();
|
||||
$oReflectionParameter = $aReflectionParameters[0];
|
||||
$sFullComment = GetMethodComment($oMethod, $oReflectionParameter->getName());
|
||||
$aParams = GetMethodParameters($oMethod, $sFullComment)[0];
|
||||
$aParams['name'] = $sName;
|
||||
$aDocGeneralParams[] = $aParams;
|
||||
|
||||
@@ -239,13 +239,13 @@ Alert common parameters
|
||||
+-------------------+----------+------------------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------------------+
|
||||
|
||||
@@ -443,11 +443,11 @@ Button common parameters
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| CSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
|
||||
@@ -61,13 +61,13 @@ ButtonGroup common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddExtraBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| Buttons | array | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -61,13 +61,13 @@ CollapsibleSection common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -202,13 +202,13 @@ DataTable common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -155,13 +155,13 @@ Field common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -61,13 +61,13 @@ FieldBadge common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -61,13 +61,13 @@ FieldSet common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -61,13 +61,13 @@ Form common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -57,11 +57,11 @@ FileSelect common parameters
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| ButtonText | string | |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
|
||||
@@ -111,11 +111,11 @@ Input common parameters
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| CSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
|
||||
@@ -86,13 +86,13 @@ Select common parameters
|
||||
+-------------------+--------------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+--------------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+--------------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+--------------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+--------------+------------------------------------------------------------+
|
||||
| AddOption | SelectOption | |
|
||||
+-------------------+--------------+------------------------------------------------------------+
|
||||
|
||||
@@ -61,11 +61,11 @@ SelectOption common parameters
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| CSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
|
||||
@@ -247,13 +247,13 @@ Panel common parameters
|
||||
+-------------------------+-----------------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------------+-----------------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------------+-----------------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------------+-----------------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------------+-----------------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------------+-----------------+------------------------------------------------------------+
|
||||
| AddMainBlock | iUIBlock | |
|
||||
+-------------------------+-----------------+------------------------------------------------------------+
|
||||
|
||||
@@ -55,11 +55,11 @@ Spinner common parameters
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| CSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
|
||||
@@ -140,13 +140,13 @@ Title common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -105,13 +105,13 @@ Toolbar common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -55,11 +55,11 @@ ToolbarSpacer common parameters
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
| CSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+--------+------------------------------------------------------------+
|
||||
|
||||
@@ -82,13 +82,13 @@ Column common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -61,13 +61,13 @@ MultiColumn common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddColumn | Column | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
@@ -85,13 +85,13 @@ UIContentBlock common parameters
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddCssFileRelPath | string | |
|
||||
| AddCssFileRelPath | string | relative path of a CSS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddDeferredBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddHtml | string | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddJsFileRelPath | string | |
|
||||
| AddJsFileRelPath | string | relative path of a JS file to add |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
| AddSubBlock | iUIBlock | |
|
||||
+-------------------+----------+------------------------------------------------------------+
|
||||
|
||||
Reference in New Issue
Block a user