-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanups, fixes and a bit of optimizations for site/components batch #3 #12292
Cleanups, fixes and a bit of optimizations for site/components batch #3 #12292
Conversation
- com_content Note: This is a single commit bundling all types of changes, since PR #12261 which had detailed commits, was rejected as a whole
$results = array ('select' => $select, 'join' => $join); | ||
|
||
return $results; | ||
return array ('select' => $select, 'join' => $join); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove the space here?
{ | ||
$this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') == 'alpha') ? 1 : (-1)); | ||
$this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') === 'alpha') ? 1 : (-1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we getting orderby_pri
param again here?
{ | ||
if ($associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $data['id'])) | ||
{ | ||
foreach ($associations as $tag => $associated) | ||
{ | ||
$associations[$tag] = (int) $associated->id; | ||
} | ||
|
||
$data['associations'] = $associations; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you remove one if block you should remove one tab inside the if.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted as in other PR
@@ -177,7 +177,7 @@ | |||
<td <?php echo $headerAuthor; ?> class="list-author"> | |||
<?php if (!empty($article->author) || !empty($article->created_by_alias)) : ?> | |||
<?php $author = $article->author ?> | |||
<?php $author = ($article->created_by_alias ? $article->created_by_alias : $author);?> | |||
<?php $author = ($article->created_by_alias ?: $author);?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not remove the parenthisis here?
Also can you add an extra space before the php end tag?
@@ -143,7 +143,7 @@ public function display($tpl = null) | |||
|
|||
// For blog layouts, preprocess the breakdown of leading, intro and linked articles. | |||
// This makes it much easier for the designer to just interrogate the arrays. | |||
if (($params->get('layout_type') == 'blog') || ($this->getLayout() == 'blog')) | |||
if (($params->get('layout_type') === 'blog') || ($this->getLayout() === 'blog')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not remove the parenthisis here too?
Made some changes as pointed out by @andrepereiradasilva
@@ -177,7 +177,7 @@ | |||
<td <?php echo $headerAuthor; ?> class="list-author"> | |||
<?php if (!empty($article->author) || !empty($article->created_by_alias)) : ?> | |||
<?php $author = $article->author ?> | |||
<?php $author = ($article->created_by_alias ? $article->created_by_alias : $author);?> | |||
<?php $author = $article->created_by_alias ?: $author; ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at this one again ...
why not , instead of too lines, use just:
<?php $author = $article->created_by_alias ?: $article->author; ?>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a bit more to refactor... coming up soon...
$childNumItems = $child->getNumItems(true); | ||
$childChildren = $child->getChildren(); | ||
$childChildrenCount = count($childChildren); | ||
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the $childNumItems = $child->getNumItems(true);
is only used if the language isRtl
and if $this->params->get('show_cat_num_articles', 1)
so it should be inside that if.
the other two are only use if $this->maxLevel > 1
so should only be processed then.
so i don't agree with this change since will run this in all cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as for the rest imo is fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄 yes, got confused by the template code... will revert...
I have tested this item ✅ successfully on c0b68fc This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12292. |
@@ -286,7 +286,6 @@ protected function getReturnPage() | |||
*/ | |||
protected function postSaveHook(JModelLegacy $model, $validData = array()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just kill the entire function. It will fall back to JControllerForm
https://github.com/frankmayer/joomla-cms/blob/c0b68fcdf7735dbd4d86aaf24d87dfab9b53db8a/libraries/legacy/controller/form.php#L520
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. I didn't follow the trail, there. Thanks
I have tested this item ✅ successfully on acd28f7 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12292. |
# Conflicts: # components/com_content/helpers/association.php # components/com_content/helpers/route.php # components/com_content/router.php # components/com_content/views/article/tmpl/default.php # components/com_content/views/categories/tmpl/default_items.php # components/com_content/views/category/tmpl/blog_children.php # components/com_content/views/category/tmpl/default_articles.php # components/com_content/views/category/tmpl/default_children.php # components/com_content/views/featured/tmpl/default.php # components/com_content/views/featured/view.feed.php # components/com_content/views/form/tmpl/edit.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some cs suggestions
@@ -458,9 +458,10 @@ public function &getChildren() | |||
{ | |||
$params = $this->getState()->get('params'); | |||
|
|||
if ($params->get('orderby_pri') == 'alpha' || $params->get('orderby_pri') == 'ralpha') | |||
$orderByPri = $params->get('orderby_pri'); | |||
if ($orderByPri === 'alpha' || $orderByPri === 'ralpha') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cs: can we have an aempty line before the if statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course :)
<?php endif; ?> | ||
<?php if ($this->maxLevel > 1 && count($child->getChildren()) > 0) : ?> | ||
<a href="#category-<?php echo $child->id;?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a> | ||
<?php endif;?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cs: please don't remove the empty space after the ;
in php closing tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this happened while merging...
<?php endif; ?> | ||
<?php if ($this->maxLevel > 1 && count($child->getChildren()) > 0) : ?> | ||
<a href="#category-<?php echo $child->id;?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a> | ||
<?php endif;?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cs: please don't remove the empty space after the ;
in php closing tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this happened while merging...
@@ -35,8 +35,8 @@ | |||
<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($child->id)); ?>"> | |||
<?php echo $this->escape($child->title); ?></a> | |||
|
|||
<?php if (count($child->getChildren()) > 0 && $this->maxLevel > 1) : ?> | |||
<a href="#category-<?php echo $child->id; ?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cs: still one here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you removed the space between ;
and ?>
@@ -49,8 +49,8 @@ | |||
</span> | |||
<?php endif; ?> | |||
|
|||
<?php if (count($child->getChildren()) > 0 && $this->maxLevel > 1) : ?> | |||
<a href="#category-<?php echo $child->id; ?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cs: still one here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you removed the space between ;
and ?>
(see lines below)
I have tested this item ✅ successfully on 0e94075 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12292. |
# Conflicts: # components/com_content/helpers/query.php # components/com_content/helpers/route.php # components/com_content/models/articles.php # components/com_content/views/category/tmpl/default_articles.php # components/com_content/views/featured/view.feed.php
Fixed some conflicts that had occurred in the meantime. |
* | ||
* @since 1.6 | ||
*/ | ||
protected function postSaveHook(JModelLegacy $model, $validData = array()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean revert the removal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forget it this is inhreited from https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/controller/form.php#L527
@frankmayer |
Note: This is a single commit bundling all types of changes, since PR #12261 which had detailed commits, was rejected as a whole