Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion administrator/components/com_content/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@

<field
name="show_vote"
type="radio"
type="voteradio"
label="JGLOBAL_SHOW_VOTE_LABEL"
layout="joomla.form.field.radio.switcher"
default="0"
Expand Down
55 changes: 55 additions & 0 deletions administrator/components/com_content/src/Field/VotelistField.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_content
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Content\Administrator\Field;

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Plugin\PluginHelper;

/**
* Votelist Field class.
*
* @since __DEPLOY_VERSION__
*/
class VotelistField extends ListField
{
/**
* The form field type.
*
* @var string
* @since __DEPLOY_VERSION__
*/
protected $type = 'Votelist';

/**
* Method to attach a form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
*
* @return boolean True on success.
*
* @since __DEPLOY_VERSION__
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
{
// Requires vote plugin enabled
if (!PluginHelper::isEnabled('content', 'vote'))
{
return false;
}

return parent::setup($element, $value, $group);
}
}
12 changes: 7 additions & 5 deletions components/com_content/tmpl/category/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@

</fieldset>

<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS"
addfieldprefix="Joomla\Component\Content\Administrator\Field"
>
<field
name="show_pagination_limit"
type="list"
Expand Down Expand Up @@ -261,10 +263,10 @@

<field
name="list_show_votes"
type="list"
type="votelist"
label="JGLOBAL_LIST_VOTES_LABEL"
layout="joomla.form.field.radio.switcher"
useglobal="true"
class="custom-select-color-state"
validate="options"
>
<option value="0" requires="vote">JHIDE</option>
Expand All @@ -273,10 +275,10 @@

<field
name="list_show_ratings"
type="list"
type="votelist"
label="JGLOBAL_LIST_RATINGS_LABEL"
layout="joomla.form.field.radio.switcher"
useglobal="true"
class="custom-select-color-state"
validate="options"
>
<option value="0" requires="vote">JHIDE</option>
Expand Down