User tests: Successful: Unsuccessful:
Pull Request for Issue # .
This class is responsible for displaying presentation data in list format.
This class is a typical example of a Model-View-Controller (MVC) pattern in Joomla, where ListView handles the presentation logic for list-type views. It's designed to be flexible and customizable through configuration options and subclassing. The use of properties like $items and $pagination suggests that this class is used to render lists of data, such as articles or products, with support for features like filtering, sorting, and pagination. The canDo property is likely used to determine user permissions for various actions within the list, ensuring that users can only perform actions they're authorized to do.
addToolbar(): This method adds the page title and toolbar to the view. It calls another method to initialize the toolbar and adds preferences and help buttons if the user has the appropriate permissions.
appendMoreButton(): This method is a placeholder for appending additional buttons to the toolbar. It provides an example of how to add an edit button based on user permissions.
The class uses Joomla's MVC pattern and provides a structured way to handle list views with support for pagination, filtering, and toolbars. The use of comments and PHPDoc blocks helps to understand the purpose and functionality of each method. The class is designed to be extensible, allowing developers to customize the view by overriding these methods in subclasses.
Variables Initialization:
Toolbar Configuration:
Transitions Handling:
It has already been discussed here
#43070
class HtmlView extends ListView
{
public function __construct($config = [])
{
$config['toolbar_title'] = Text::_('COM_XYZ');
$config['option'] = ApplicationHelper::getComponentName();
$config['toolbar_icon'] = 'signup';
$config['help_link'] = '#';
parent::__construct($config);
}
}
Toolbar show buttons side by side
Toolbar show dropdown button
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Title |
|
Please explain what these changes add to Joomla and how this is different than the current behaviour. Please use your own words and not chatgpt to describe these changes and not just provide a documentation of the code.
Labels |
Added:
PR-5.2-dev
|
Hello,
New figure of List view after changes commit.
Developers can create HtmlView class extends \Joomla\MVC\View\ListView class, this class is suiet for any pages that show items (records of database). Toolbar is similar to com_content and other core component...
As far as I was familiar with the structure of Joomla, I observed the cases. Again, if I have forgotten something, please let me know.
When you add new code to Joomla that requires a new docblock we do not put a value for @since
as the code may not be merged in that version. Instead we require you to use @since __DEPLOY_VERSION__
. When it is merged and a new Joomla release is made then we have internal build scripts that will create the correct value.
I done it...
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-04-10 20:25:59 |
Closed_By | ⇒ | Hackwar |
Hello @sinahaghparast thank you for your contribution. We discussed this today in the maintainer meeting and unfortunately we see a few problems with this. We understand what you are trying to do, but we don't think that your approach is really that universal as you want it to be.
More importantly however we think such a solution would need a greater plan and concept. If you want to introduce rapid development code (similar to FoF, which we had in the past, or Koowa) this should be based on an overarching plan which covers basically all parts of a component or, even better, all extension types. It would be highly problematic to have a new concept like this one and then it is ONLY applied to this one class. And then a few months later someone else comes along and creates something similar to the toolbar in the edit view and uses a different concept than yours. That would mean quite a mess. That is why we think without a greater plan we can't even start working into that direction.
It would be good if you could join an initiative on Mattermost to create such a greater plan. Until then I unfortunately have to close this PR.
My above change suggestions are only a few of the many violated code style rules. We use PSR-12 rules.