src/Background/Background.php
protected function getVars($content, $details = [])
    {
        // Build defaults
        $defaults = [
            'id' => '',
            'title' => Translate::t('background.title', [], 'backgroundfield'),
            'height' => '60',
            'width' => '150',
            'description' => '',
            'backgrounds' => false,
            'can_upload' => current_user_can('upload_files'),
            'delete' => Translate::t('background.delete', [], 'backgroundfield'),
            'details' => $this->getBackgroundDetails(),

            // defaults
            'default' => [
                'image' => '',
                'color' => '',
                'position' => '0 0',
                'repeat' => 'repeat',
                'size' => 'auto',
            ],

            // texts
            't_add_background' => Translate::t('background.add_background', [], 'backgroundfield'),
            't_cannot_upload' => Translate::t('background.cannot_upload', [], 'backgroundfield'),
            't_remove' => Translate::t('background.remove_background', [], 'backgroundfield'),

            't_choose_bg' => Translate::t('background.choose_background_image', [], 'backgroundfield'),
            't_choose_color' => Translate::t('background.choose_background_color', [], 'backgroundfield'),
            't_choose_repeat' => Translate::t('background.choose_background_repeat', [], 'backgroundfield'),
            't_choose_position_title' => Translate::t('background.choose_background.title', [], 'backgroundfield'),
            't_choose_position_position' => Translate::t('background.choose_background.position', [], 'backgroundfield'),
            't_choose_position_size' => Translate::t('background.choose_background.size', [], 'backgroundfield'),
        ];

        // Build defaults data
        $vars = array_merge($defaults, $content);

        // Retrieve field value
        $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);

        // Update vars
        $this->getModel()->setVars($vars);
    }
protected function getVars($content, $details = [])
    {
        // Build defaults
        $defaults = [
            'id' => '',
            'title' => Translate::t('background.title', [], 'backgroundfield'),
            'height' => '60',
            'width' => '150',
            'description' => '',
            'backgrounds' => false,
            'can_upload' => current_user_can('upload_files'),
            'delete' => Translate::t('background.delete', [], 'backgroundfield'),
            'details' => $this->getBackgroundDetails(),

            // defaults
            'default' => [
                'image' => '',
                'color' => '',
                'position' => '0 0',
                'repeat' => 'repeat',
                'size' => 'auto',
            ],

            // texts
            't_add_background' => Translate::t('background.add_background', [], 'backgroundfield'),
            't_cannot_upload' => Translate::t('background.cannot_upload', [], 'backgroundfield'),
            't_remove' => Translate::t('background.remove_background', [], 'backgroundfield'),

            't_choose_bg' => Translate::t('background.choose_background_image', [], 'backgroundfield'),
            't_choose_color' => Translate::t('background.choose_background_color', [], 'backgroundfield'),
            't_choose_repeat' => Translate::t('background.choose_background_repeat', [], 'backgroundfield'),
            't_choose_position_title' => Translate::t('background.choose_background.title', [], 'backgroundfield'),
            't_choose_position_position' => Translate::t('background.choose_background.position', [], 'backgroundfield'),
            't_choose_position_size' => Translate::t('background.choose_background.size', [], 'backgroundfield'),
        ];

        // Build defaults data
        $vars = array_merge($defaults, $content);

        // Retrieve field value
        $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);

        // Update vars
        $this->getModel()->setVars($vars);
    }
Prepare HTML component.

@param array $content
@param array $details