Jump to content

move blockpermanentlinks to new hook?


Recommended Posts

I've created a couple of new hooks with a custom module. Now i want to move the hooking of some std-modules to the new location, especially the blockpermantentlinks shall go to a hook called

HOOK_TOPRIGHT

 

i created a directory blockpermanentlinks in my themes modules-directory and copied the blockpermantentlinks.php into that directory, i changed the install-fn…

 

public function install()
{
  return (parent::install()
     && $this->registerHook('topRight'));
}

 

and added a fn for the hook…

 

public function hookTopRight($params)
{
  return $this->hookTop($params);
}

 

…because it shall do the same as in HOOK-TOP, but still, it does not show up in the correct location. Also, i cant use the modules->position-menu because all entries are greyed out. How can i change that? Is there a way to get rid of that useless drag&drop editor that seems to block those entires but doesnt provide handles for inline-block elements?

 

Is there a *generic* way to rehook modules, e.g walk thru some array, compare modules by name and directly change their hooking? would be much easier that flooding the modules-directory of the theme with copypasta…

Edited by .rhavin (see edit history)
Link to comment
Share on other sites

Actually you can't override a Module PHP file (Yeah I know that's kinda sad). You need to edit it directly. BUT IF you do that, and somehow later (In a galaxie far away) you decide to update the module, all your changes will be discarded.

 

So, how do we manage to do that not huh?

 

Create a copy of the module, change the reference, class name, css file name even the tpl name to be sure. Be sure to change the config.xml so it won't listen to update. Activate the said module and use it.

 

Martin

Link to comment
Share on other sites

@El patron : I think he did it in his theme

i created a directory blockpermanentlinks in my themes modules-directory and copied the blockpermantentlinks.php into that directory, i changed the install-fn…

 

And, correct me if I'm wrong (I would really love to be), you can't override a module PHP file right?

 

Martin

Edited by Martin Uker K (see edit history)
Link to comment
Share on other sites

did you uninstall and then re-install?

 

Well, of course i did. Martin Uker K suggested to rename the module, but that wont work either. What about my generic idea? is there any way to walk thru the registered hooks and rehook the modules without changing them? I mean, if thats not possible, your design options are VERY limited, if you want to give your admins the freedom to add new modules ;(

Edited by .rhavin (see edit history)
Link to comment
Share on other sites

@Vekia : You had to destroy my hopes...

 

@El Patron : You still have great style even when youare off posting!

 

@.rhavin Okay You misunderstood me

 

Martin Uker K suggested to rename the module, but that wont work either.

 

I hadn't been clear enough sorry, I suggested duplicating it, and it works. You can also achieve this with composition, but you need to make sure you don't use both modules on hooks and that pratice isn't noob proof (You can blow up your website easily if you are not skilled enough).

 

Duplicating won't make the module updatable, but at least he will coexist with the other and he won't be discarded by and update

 

Composition make the modules uncohexistant. They are impossible to use both at once, but your module will have the updates and will take the place of the older one. (Replacing the old one but using the old module as a core)

 

What about my generic idea? is there any way to walk thru the registered hooks and rehook the modules without changing them?

 

Not if they don't have the necessary method. They need to be able to register to this hook.

 

I mean, if thats not possible, your design options are VERY limited, if you want to give your admins the freedom to add new modules ;(

 

The "design options" aren't limited. Architecturally speaking Modularity is flexibiliy. Sure the fact that hooks aren't all the same is a bit disapointing. But if all the hooks were the same they would need to share and use the same data. Which means : all the product's page hooks would need all the DATA from product. This would be quite heavy to push and use. Flexibility would have cost a lot in that case. All that data unused in the Header and footerhook. Why would we make modules compatible with all hooks if the left column and the footer doesn't have the same dimension??? Or even the same purpose?

 

If you have a easier implementation as flexible and performant to suggest, I would be happy to talk about it.

 

Best regards,

Martin

 

P.S. I suggest a new strategy R2, let the wookie win.

Edited by Martin Uker K (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...