FAF: Documentation UI Twig Blocks

This commit is contained in:
Eric
2021-05-29 11:46:15 +02:00
parent b87afed08a
commit 862e49ba4e
22 changed files with 86 additions and 43 deletions

View File

@@ -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;

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------------------+

View File

@@ -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> |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -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> |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+--------------+------------------------------------------------------------+

View File

@@ -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> |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------------+-----------------+------------------------------------------------------------+

View File

@@ -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> |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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> |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -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 | |
+-------------------+----------+------------------------------------------------------------+