src/Wordpress/Wordpress.php
protected function getVars($content, $details = [])
    {
        // Build defaults
        $defaults = [
            'id' => '',
            'title' => Translate::t('wordpress.title', [], 'wordpressfield'),
            'default' => [],
            'description' => '',
            'mode' => 'posts',
            'multiple' => false,
            'options' => [],
            'value' => '',

            // Texts
            't_items' => Translate::t('wordpress.items', [], 'wordpressfield'),
        ];

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

        // Check if an id is defined at least
        $postid = !isset($details['post_id']) ? 0 : $details['post_id'];

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

        // Get the categories
        $vars['contents'] = $this->getWPContents(
            $vars['mode'],
            $vars['multiple'],
            $vars['options'],
            $postid,
            $vars['value']
        );

        // Field description
        if (!empty($vars['contents']) && 1 <= count($vars['contents'])) {
            $description = $vars['multiple'] ? Translate::t('wordpress.description', [], 'wordpressfield').'<br/>' : '';
        } else {
            $translate = $vars['multiple'] ? 'wordpress.no_items_found' : 'wordpress.no_item_found';
            $description = sprintf(Translate::t($translate, [], 'wordpressfield'), $vars['mode']).'<br/>';
        }

        // Update description
        $vars['description'] = $description.$vars['description'];

        // Update vars
        $this->getModel()->setVars($vars);
    }
protected function getVars($content, $details = [])
    {
        // Build defaults
        $defaults = [
            'id' => '',
            'title' => Translate::t('wordpress.title', [], 'wordpressfield'),
            'default' => [],
            'description' => '',
            'mode' => 'posts',
            'multiple' => false,
            'options' => [],
            'value' => '',

            // Texts
            't_items' => Translate::t('wordpress.items', [], 'wordpressfield'),
        ];

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

        // Check if an id is defined at least
        $postid = !isset($details['post_id']) ? 0 : $details['post_id'];

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

        // Get the categories
        $vars['contents'] = $this->getWPContents(
            $vars['mode'],
            $vars['multiple'],
            $vars['options'],
            $postid,
            $vars['value']
        );

        // Field description
        if (!empty($vars['contents']) && 1 <= count($vars['contents'])) {
            $description = $vars['multiple'] ? Translate::t('wordpress.description', [], 'wordpressfield').'<br/>' : '';
        } else {
            $translate = $vars['multiple'] ? 'wordpress.no_items_found' : 'wordpress.no_item_found';
            $description = sprintf(Translate::t($translate, [], 'wordpressfield'), $vars['mode']).'<br/>';
        }

        // Update description
        $vars['description'] = $description.$vars['description'];

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

@param array $content
@param array $details