raoul2000\workflow\helpers\WorkflowHelper::renderLabel PHP Method

renderLabel() public static method

This method assumes that the status includes a metadata value called 'labelTemplate' that contains the HTML template of the rendering status. In this template the string '{label}' will be replaced by the status label. Example :
	'status' => [
		'draft' => [
			'label' => 'Draft',
			'transition' => ['ready' ],
			'metadata' => [
				'labelTemplate' => '{label}'
			]
		],
public static renderLabel ( BaseActiveRecord $model ) : string | null
$model yii\db\BaseActiveRecord
return string | null the HTML rendered status or null if not labelTemplate is found
    public static function renderLabel($model)
    {
        if ($model->hasWorkflowStatus()) {
            $labelTemplate = $model->getWorkflowStatus()->getMetadata('labelTemplate');
            if (!empty($labelTemplate)) {
                return strtr($labelTemplate, ['{label}' => $model->getWorkflowStatus()->getLabel()]);
            }
        }
        return null;
    }