function smarty_block_mf_button($params, $content, $smarty, &$isOpeningTag)
{
    // we don't have anything to do when the block is open
    if ($isOpeningTag) {
        return '';
    }
    $formBlock = FormBlockHelper::fromSmarty($smarty);
    return $formBlock->registerAndRenderAction(new Button($params, $content));
}
Beispiel #2
0
/**
 * Render a form, and handle validation if it's a POST request
 */
function smarty_block_mf_form($params, $content, $smarty, &$isOpeningTag)
{
    // default form id
    if (!isset($params['id'])) {
        $params['id'] = 'mistyforms';
    }
    if ($isOpeningTag) {
        $handler = HandlerHelper::fromSmarty($smarty);
        $form = new Form($handler, !empty($_POST) ? $_POST : null);
        $formBlock = new FormBlock($form, $params);
        FormBlockHelper::toSmarty($smarty, $formBlock);
    } else {
        $formBlock = FormBlockHelper::fromSmarty($smarty);
        $formBlock->executeActions();
        return $formBlock->renderWithContent($content);
    }
}
Beispiel #3
0
function smarty_block_mf_row($params, $content, $smarty, &$isOpeningTag)
{
    // we don't have anything to do when the block is open
    if ($isOpeningTag) {
        return '';
    }
    $inputId = false;
    if (isset($params['for'])) {
        $inputId = $params['for'];
        unset($params['for']);
    }
    if (isset($params['label'])) {
        $params['text'] = $params['label'];
        unset($params['label']);
    }
    $formBlock = FormBlockHelper::fromSmarty($smarty);
    return $formBlock->registerAndRenderLabel(new Row($params, $content), $inputId);
}
function smarty_function_mf_checkbox($params, $smarty)
{
    $formBlock = FormBlockHelper::fromSmarty($smarty);
    return $formBlock->registerAndRenderInput(new CheckBox($params, $smarty->getTemplateVars()));
}
function smarty_function_mf_radiobutton($params, $smarty)
{
    $formBlock = FormBlockHelper::fromSmarty($smarty);
    return $formBlock->registerAndRenderInput(new RadioButton($params, $smarty->getTemplateVars()));
}
function smarty_function_mf_email($params, $smarty)
{
    $formBlock = FormBlockHelper::fromSmarty($smarty);
    return $formBlock->registerAndRenderInput(new EmailField($params, $smarty->getTemplateVars()));
}
function smarty_function_mf_textarea($params, $smarty)
{
    $formBlock = FormBlockHelper::fromSmarty($smarty);
    return $formBlock->registerAndRenderInput(new TextArea($params, $smarty->getTemplateVars()));
}
function smarty_function_mf_submit($params, $smarty)
{
    $formBlock = FormBlockHelper::fromSmarty($smarty);
    return $formBlock->registerAndRenderAction(new Submit($params));
}