src/OpenCart/Helpers/OcHelper.php
protected function renderFormCommon($task, $button)
    {
        // Process the form if it was submitted and render it again.
        $form = $this->container->getForm($task);
        $form->process();
        // Force the creation of the fields to get connection error messages
        // shown.
        $form->getFields();

        // Show messages.
        foreach ($form->getSuccessMessages() as $message) {
            $this->addSuccess($message);
        }
        foreach ($form->getWarningMessages() as $message) {
            $this->addWarning($this->t($message));
        }
        foreach ($form->getErrorMessages() as $message) {
            $this->addError($this->t($message));
        }

        $this->data['form'] = $form;
        $this->data['formRenderer'] = $this->container->getFormRenderer();

        // Complete the breadcrumb with the current path.
        $link = $this->getLocation();
        if ($task !== 'config') {
            $link .= "/$task";
        }
        $this->data['breadcrumbs'][] = array(
            'text' => $this->t("{$task}_form_header"),
            'href' => $this->registry->getLink($link),
            'separator' => ' :: '
        );

        // Set the action buttons (action + text).
        $this->data['action'] = $this->registry->getLink($link);
        $this->data['button_icon'] = $task === 'batch' ? 'fa-envelope-o' : ($task === 'uninstall' ? 'fa-delete' : 'fa-save');
        $this->data['button_save'] = $this->t($button);
        $this->data['cancel'] = $this->registry->getLink('common/dashboard');
        $this->data['button_cancel'] = $task === 'uninstall' ? $this->t('button_cancel_uninstall') : $this->t('button_cancel');

        $this->setOutput();
    }
protected function renderFormCommon($task, $button)
    {
        // Process the form if it was submitted and render it again.
        $form = $this->container->getForm($task);
        $form->process();
        // Force the creation of the fields to get connection error messages
        // shown.
        $form->getFields();

        // Show messages.
        foreach ($form->getSuccessMessages() as $message) {
            $this->addSuccess($message);
        }
        foreach ($form->getWarningMessages() as $message) {
            $this->addWarning($this->t($message));
        }
        foreach ($form->getErrorMessages() as $message) {
            $this->addError($this->t($message));
        }

        $this->data['form'] = $form;
        $this->data['formRenderer'] = $this->container->getFormRenderer();

        // Complete the breadcrumb with the current path.
        $link = $this->getLocation();
        if ($task !== 'config') {
            $link .= "/$task";
        }
        $this->data['breadcrumbs'][] = array(
            'text' => $this->t("{$task}_form_header"),
            'href' => $this->registry->getLink($link),
            'separator' => ' :: '
        );

        // Set the action buttons (action + text).
        $this->data['action'] = $this->registry->getLink($link);
        $this->data['button_icon'] = $task === 'batch' ? 'fa-envelope-o' : ($task === 'uninstall' ? 'fa-delete' : 'fa-save');
        $this->data['button_save'] = $this->t($button);
        $this->data['cancel'] = $this->registry->getLink('common/dashboard');
        $this->data['button_cancel'] = $task === 'uninstall' ? $this->t('button_cancel_uninstall') : $this->t('button_cancel');

        $this->setOutput();
    }
protected function renderFormCommon ( $ task , $ button ) { // Process the form if it was submitted and render it again. $ form = $ this -> container -> getForm ( $ task ) ; $ form -> process ( ) ; // Force the creation of the fields to get connection error messages // shown. $ form -> getFields ( ) ; // Show messages. foreach ( $ form -> getSuccessMessages ( ) as $ message ) { $ this -> addSuccess ( $ message ) ; } foreach ( $ form -> getWarningMessages ( ) as $ message ) { $ this -> addWarning ( $ this -> t ( $ message ) ) ; } foreach ( $ form -> getErrorMessages ( ) as $ message ) { $ this -> addError ( $ this -> t ( $ message ) ) ; } $ this -> data [ 'form' ] = $ form ; $ this -> data [ 'formRenderer' ] = $ this -> container -> getFormRenderer ( ) ; // Complete the breadcrumb with the current path. $ link = $ this -> getLocation ( ) ; if ( $ task !== 'config' ) { $ link .= "/$task" ; } $ this -> data [ 'breadcrumbs' ] [ ] = array ( 'text' => $ this -> t ( "{$task}_form_header" ) , 'href' => $ this -> registry -> getLink ( $ link ) , 'separator' => ' :: ' ) ; // Set the action buttons (action + text). $ this -> data [ 'action' ] = $ this -> registry -> getLink ( $ link ) ; $ this -> data [ 'button_icon' ] = $ task === 'batch' ? 'fa-envelope-o' : ( $ task === 'uninstall' ? 'fa-delete' : 'fa-save' ) ; $ this -> data [ 'button_save' ] = $ this -> t ( $ button ) ; $ this -> data [ 'cancel' ] = $ this -> registry -> getLink ( 'common/dashboard' ) ; $ this -> data [ 'button_cancel' ] = $ task === 'uninstall' ? $ this -> t ( 'button_cancel_uninstall' ) : $ this -> t ( 'button_cancel' ) ; $ this -> setOutput ( ) ; }
Performs the common tasks when processing and rendering a form.

@param string $task
@param string $button
Performs the common tasks when processing and rendering a form .