Skip to content
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

Refactor SearchModule #3470

Merged
merged 7 commits into from
Feb 19, 2017
Merged

Refactor SearchModule #3470

merged 7 commits into from
Feb 19, 2017

Conversation

craigh
Copy link
Member

@craigh craigh commented Feb 18, 2017

Q A
Bug fix? yes
New feature? yes
BC breaks? yes
Deprecations? yes
Fixed tickets -
Refs tickets -
License MIT
Changelog updated yes

Description

  • eliminate or deprecate all legacy code usage.
  • update previous SearchableInterface to add form handling
  • update Users search functionality
  • correct search block template overrides in core themes
  • update documentation

 - eliminate or deprecate all legacy code usage.
 - update previous SearchableInterface to add form handling
 - update Users search functionality
 - correct search block template overrides in core themes
 - update documentation
[ci skip] [skip ci]
@craigh craigh added this to the 1.4.7 milestone Feb 18, 2017
@craigh craigh self-assigned this Feb 18, 2017
@craigh craigh requested a review from Guite February 18, 2017 21:39
CHANGELOG-1.4.md Outdated

- Fixes:
- Corrected path to legacy module's admin icons.
- Made display names of Menu and Theme modules more readable (#3448).

- Features:
- Added Permission-based controls for MenuModule menu items (#3314).
- Added Permission-based controls for MenuModule menu items (#3314).'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo (quote at the end of the line)

@@ -94,7 +135,7 @@ public function getFormOptions()
}
// remove disabled
foreach ($searchModules as $displayName => $moduleName) {
if ((bool) $this->getVar('disable_' . $moduleName, true)) {
if ((bool) $this->getVar('disable_' . $moduleName, false)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BC break?
I'd guess that a default value of true is more reasonable because it does not immediately add new modules to the search (which may not be desired).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't work the other way for me.

if ($setActiveDefaults) {
$activeModules[$moduleName] = 1;
}
if ($this->getVar('disable_' . $moduleName)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value?

throw new AccessDeniedException();
}

$startnum = $request->query->filter('startnum', 0, false, FILTER_VALIDATE_INT);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$request->query->getInt('startnum', 0)

}

$startnum = $request->query->filter('startnum', 0, false, FILTER_VALIDATE_INT);
$itemsPerPage = $this->getVar('itemsperpage');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value?

*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
if ($options['permissionApi']->hasPermission($builder->getName() . '::', '::', ACCESS_READ)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does $builder->getName() return here for example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that case, the module name

@Guite
Copy link
Member

Guite commented Feb 19, 2017

Great stuff! refs #3206 and #3307

'translator' => $this->get('translator.default'),
'action' => $this->get('router')->generate('zikulasearchmodule_search_execute')
]);
$form->add($moduleFormBuilder->getForm());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the "magic" is done :-)

@craigh craigh merged commit 7c3c160 into 1.4 Feb 19, 2017
@craigh craigh deleted the search branch February 19, 2017 13:10
@@ -11,7 +11,6 @@

namespace Zikula\SearchModule\Block;

use ModUtil;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not import from global namespace

does this make a difference?

Personally I prefer the import against using \Foo because it is more explicite about which classes are used within a class. Just a matter of taste or is there a behavioural difference?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no behavior diff AFAIK but easier to delete on merge to master without forgetting the import

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants