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#12292wilsonge merged 9 commits intojoomla:stagingfrom frankmayer:site-com_content-com_contenthistory
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.
can we remove the space here?
| if ($orderByPri === 'alpha' || $orderByPri === 'ralpha') | ||
| { | ||
| $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.
why are we getting orderby_pri param again here?
| $associations[$tag] = (int) $associated->id; | ||
| } | ||
|
|
||
| $data['associations'] = $associations; |
There was a problem hiding this comment.
if you remove one if block you should remove one tab inside the if.
There was a problem hiding this comment.
Noted as in other PR
| <?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.
why not remove the parenthisis here?
Also can you add an extra space before the php end tag?
| // 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.
why not remove the parenthisis here too?
Made some changes as pointed out by @andrepereiradasilva
| <?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.
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.
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.
the $childNumItems = $child->getNumItems(true); is only used if the language isRtland 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.
as for the rest imo is fine
There was a problem hiding this comment.
😄 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.
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.
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
andrepereiradasilva
left a comment
There was a problem hiding this comment.
some cs suggestions
|
|
||
| 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.
cs: can we have an aempty line before the if statement?
| <?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.
cs: please don't remove the empty space after the ; in php closing tags
There was a problem hiding this comment.
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.
cs: please don't remove the empty space after the ; in php closing tags
There was a problem hiding this comment.
Sorry, this happened while merging...
| <?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.
cs: still one here
There was a problem hiding this comment.
you removed the space between ; and ?>
| <?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.
cs: still one here
There was a problem hiding this comment.
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. |
| * @return void | ||
| * | ||
| * @since 1.6 | ||
| */ |
There was a problem hiding this comment.
Can we remove this?
There was a problem hiding this comment.
Do you mean revert the removal?
There was a problem hiding this comment.
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