Back to JGrid class

Method publishedOptions

public static array
publishedOptions
(mixed $config = array())
Returns an array of standard published state filter options.
Parameters
  • array $config An array of configuration options. This array can contain a list of key/value pairs where values are boolean and keys can be taken from 'published', 'unpublished', 'archived', 'trash', 'all'. These pairs determine which values are displayed.
Returns
  • array The array of standard published state filter options
Since
  • 1.6
Class: JGrid
Project: Joomla

Method publishedOptions - Source code

/**
 * Returns an array of standard published state filter options.
 *
 * @param   array  $config  An array of configuration options.
 *                          This array can contain a list of key/value pairs where values are boolean
 *                          and keys can be taken from 'published', 'unpublished', 'archived', 'trash', 'all'.
 *                          These pairs determine which values are displayed.
 *
 * @return  array  The array of standard published state filter options
 *
 * @since   1.6
 */
public static function publishedOptions($config = array())
{
    // Build the active state filter options.
    $options = array();
    if (!array_key_exists('published', $config) || $config['published']) {
        $options[] = HTMLHelper::_('select.option', '1', 'JPUBLISHED');
    }
    if (!array_key_exists('unpublished', $config) || $config['unpublished']) {
        $options[] = HTMLHelper::_('select.option', '0', 'JUNPUBLISHED');
    }
    if (!array_key_exists('archived', $config) || $config['archived']) {
        $options[] = HTMLHelper::_('select.option', '2', 'JARCHIVED');
    }
    if (!array_key_exists('trash', $config) || $config['trash']) {
        $options[] = HTMLHelper::_('select.option', '-2', 'JTRASHED');
    }
    if (!array_key_exists('all', $config) || $config['all']) {
        $options[] = HTMLHelper::_('select.option', '*', 'JALL');
    }
    return $options;
}