Jump to content

Edit History

joaorodr84

joaorodr84

    protected function getConfigForm()
    {
        // ADDED THESE 3 LINES
        $background_image = $this->getDataFromDB()['background_image'];
        $image_url = $background_image ? '/modules/cb_sectionaboutus/img/' . $background_image : '';
        $image = '<div class="col-lg-6"><img src="' . $image_url . '" class="img-thumbnail" width="400"></div>';

        return array(
            'form' => array(
                'legend' => array(
                    'title' => $this->l('Settings'),
                    'icon' => 'icon-cogs'
                ),
                'input' => array(
                    array(
                        'type' => 'file',
                        'label' => $this->l('Background Image'),
                        'name' => 'background_image',
                        'desc' => $this->l('Maximum image size: ') . $this->upload_file_size_limit_in_mb . ' MB.',
                        'display_image' => true,
                        'image' => $image  // ADDED THIS OPTION
                    ),
                    array(
                        'type' => 'textarea',
                        'label' => $this->l('Title'),
                        'name' => 'title',
                        'desc' => $this->l('Enter the title'),
                        'class' => 'rte',
                        'autoload_rte' => true
                    )
                ),
                'submit' => array(
                    'title' => $this->l('Save'),
                ),
            ),
        );
    }

 

and remove everything from the template.

 

joaorodr84

joaorodr84

    protected function getConfigForm()
    {
        // ADDED THERE 3 LINES
        $background_image = $this->getDataFromDB()['background_image'];
        $image_url = $background_image ? '/modules/cb_sectionaboutus/img/' . $background_image : '';
        $image = '<div class="col-lg-6"><img src="' . $image_url . '" class="img-thumbnail" width="400"></div>';

        return array(
            'form' => array(
                'legend' => array(
                    'title' => $this->l('Settings'),
                    'icon' => 'icon-cogs'
                ),
                'input' => array(
                    array(
                        'type' => 'file',
                        'label' => $this->l('Background Image'),
                        'name' => 'background_image',
                        'desc' => $this->l('Maximum image size: ') . $this->upload_file_size_limit_in_mb . ' MB.',
                        'display_image' => true,
                        'image' => $image  // ADDED THIS OPTION
                    ),
                    array(
                        'type' => 'textarea',
                        'label' => $this->l('Title'),
                        'name' => 'title',
                        'desc' => $this->l('Enter the title'),
                        'class' => 'rte',
                        'autoload_rte' => true
                    )
                ),
                'submit' => array(
                    'title' => $this->l('Save'),
                ),
            ),
        );
    }

 

and remove everything from the template.

 

×
×
  • Create New...