# acymailing/trunk/front/Params/article.php

AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress, version trunk. 78 lines.

- Page: https://pluginprobe.com/plugins/acymailing/trunk/code/front/Params/article.php
- Raw: https://pluginprobe.com/plugins/acymailing/trunk/raw/front/Params/article.php
- Modified: 2026-08-03T10:18:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/acymailing/trunk/code/front/Params/article.php#L10-L20`.

```php
<?php
defined('ABSPATH') || die('Restricted Access');

include_once __DIR__.DIRECTORY_SEPARATOR.'AcymJFormField.php';

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Joomla specific class naming with imposed prefix "JFormField".
class JFormFieldArticle extends AcymJFormField
{
    public function __construct($form = null)
    {
        $this->type = 'article';
        parent::__construct($form);
    }

    public function getInput()
    {
        $modalId = 'acym_article_'.$this->id;
        $callback = 'jSelectArticle_'.$this->id;

        $title = '';
        $value = intval($this->value);
        if (!empty($value)) {
            $title = acym_CMSArticleTitle($value);
        }

        // Callback function from the modal to the main window
        acym_addScript(
            true,
            "
            function $callback(id, title, catid, object, url, language) {
                window.processModalSelect('Article', '".$this->id."', id, title, catid, object, url, language);
                toggle_$callback(id);
                jQuery('#".$modalId."').modal('hide');
            }
            
            function toggle_$callback(selection) {
                if (selection && selection > 0) {
                    jQuery('#button_$modalId').hide();
                    jQuery('#clear_$modalId').show();
                } else {
                    jQuery('#".$this->id."_name').val('');
                    jQuery('#".$this->id."_id').val('');
                    
                    jQuery('#button_$modalId').show();
                    jQuery('#clear_$modalId').hide();
                }
            }
            
            jQuery(function($){
                toggle_$callback($value);
            });"
        );

        $html = '<span class="input-append">';
        $html .= '<input class="input-medium" id="'.$this->id.'_name" type="text" value="'.esc_attr($title).'" disabled="disabled" size="35" />';
        $urlSelect = acym_articleSelectionPage().'&function='.$callback;
        $html .= acym_cmsModal(
            true,
            $urlSelect,
            'ACYM_SELECT',
            true,
            acym_translation('ACYM_SELECT_AN_ARTICLE'),
            $modalId
        );
        $html .= '<a id="clear_'.$modalId.'" class="btn hasTooltip" data-toggle="modal" role="button" onclick="toggle_'.$callback.'(0);">'.acym_translation('ACYM_CLEAR').'</a>';
        $html .= '</span>';

        $html .= '<input type="hidden" id="'.$this->id.'_id" name="'.$this->name.'" value="'.$value.'" />';

        return $html;
    }

    public function getLabel()
    {
        return str_replace($this->id, $this->id.'_id', parent::getLabel());
    }
}

```
