Jump to content
kongondo

Menu Builder

Recommended Posts

3 hours ago, Mike Rockett said:

It does appear to work, but the root page is also assigned the current class when viewing any decsendant.

My bad! I forgot to do that check. We check by looking at $page->parents....Since home is everybody's parents, it passes the logic. I'll fix this in the next commit. 

3 hours ago, Mike Rockett said:

Is there no clean way to add an option to specific menu items that states "add current class here if an included / non-included descendant is current"?

RE 'specific menu items':

Unlike the backend per-menu-item setting Include natural children, you cannot cherry pick which items to apply current class to. That has to be done at a global level, aka $options.  For the benefit of others reading this, in this regard, 'current_class' and 'current_class_level' work globally. For 'current_class_level' = 0 we target current $page that is not part of the MB menu items (aka non-included) in order to apply 'current_class' to its NATURAL (ProcessWire) ancestors in the MB menu. For 'current_class_level' > 1, we target current $page that is either part of the MB menu or that was made part of the MB menu via 'include_children' in order to apply 'current_class' to itself as well as its Menu Builder ancestors in the MB menu if applicable. 

Back to Mike's question, as stated in some previous posts, for such fine-grained/specific control, I recommend using the getMenuItems() method with your own custom function.  Please see this post for examples as well as custom functions + gists. Please note that currently, getMenuItems() does not support 'include_children' but it will soon.

Share this post


Link to post
Share on other sites
5 minutes ago, kongondo said:

My bad! I forgot to do that check. We check by looking at $page->parents....Since home is everybody's parents, it passes the logic. I'll fix this in the next commit. 

I thought that may be the case -- thanks!

And thanks for the explanation, I understand how it works now.

Share this post


Link to post
Share on other sites

Update: Menu Builder Version 0.2.1.

Changelog

  1. Fixed bug in 'current_class_level' where 'current_class' was being applied to 'Home' menu item when level was set to '0'.
  2. getMenuItems() now honours both locally and globally set 'include_children'.
  3. Added 'cached_menu' option to MarkupMenuBuilder to save and fetch menus from cache to speed up menu rendering if required.
  4. Added 'cached_menu_time' to set cached menu expiration time. For compatible times, see WireCache docs.
  5. Fixed bug in ProcessMenuBuilder where 'include_children' and 'm_max_level' inputs would be displayed when the page selected to add to menu was 'Home' (These options do not apply to Home).

Note

Cached Menu

  • The benefits of this feature will likely be small for most sites as menu rendering is already fast. However, for cases where you have lots of items in your menu (or in your site map if you are using Menu Builder for such), you will notice some difference. In addition, since cached menus save the full menu items array to the database (JSON of items only; not the markup!), it means you avoid the internal multiple pages->get() for getting menu items. You only hit the database once or twice (WireCache) and you got your menu! The feature also works with multi-lingual sites, in which case each language's menu is cached separately. Anyway, the feature is there for those that need it.
  • Please note that the feature does not work with getMenuItems() since in such cases you are retrieving menu items to do what you will with them (even cache them yourself if you wish).
  • Limitations: Currently, cached menus ONLY respect 'current_class_level' 0 and 1 (the default). This is because the 'current-ness' of a menu item should not be cached! That has to be checked live [EDIT].

 

News features in dev branch only for now. Please let me know how it goes, thanks.

Edited by kongondo
Oversights and then some!
  • Like 2

Share this post


Link to post
Share on other sites
37 minutes ago, Mike Rockett said:

@kongondo Thanks! Works like a charm now.

Good to know. Thanks for testing!

Please note I've just pushed a new commit (but did not change versions) to fix some oversight in the last commit. It should not affect you unless you are using the cached menu feature. I've also updated my previous post.

  • Like 2

Share this post


Link to post
Share on other sites

Hi! kongondo, Menu Builder is vety easy to use and powerful, But now I'm going to add some css3 effects to the menu.

Can you add a custom tpl parameter to the list item.

E.g. I want to make it

<li> <a href="">item name</a></li>

into

<li> <a href=""><span data="item name">item name</span></a></li>

The final effect is like this webpage's top menu:

http://mo005-3785.mo5.line1.uemo.net/list/id/37389/

Share this post


Link to post
Share on other sites
4 hours ago, taoguang said:

Can you add a custom tpl parameter to the list item.

Hi @taoguang. Welcome to the forums.

For such custom markup, I recommend you make use of the getMenuItems() method as described in this post. I am happy to assist if you do get stuck.

  • Like 1

Share this post


Link to post
Share on other sites
18 hours ago, kongondo said:
18 hours ago, kongondo said:

Hi @taoguang. Welcome to the forums.

For such custom markup, I recommend you make use of the getMenuItems() method as described in this post. I am happy to assist if you do get stuck.

Cool! Thank you, With this method, Now I can do almost anything!

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi @kongondo

Thank you for so great module!

I use 0.1.7 version of module and get 

PHP Notice: Array to string conversion in ...\ProcessMenuBuilder\MarkupMenuBuilder.module:922

Here is how I use it

$menu_page = pages(1023);
if($lang_name == "ukrainian") {
    $menu_page = pages(1024);
}

$menu = $menuModule->getMenuItems($menu_page, 1, [
    "current_class_level" => 2
]);

Changing this line

$menuItems = '';

to 

$menuItems = array();

fixes it. 

Am I missing something? 

Share this post


Link to post
Share on other sites

Hi @Zeka

Yeah, PHP 7 is a little more stricter. PHP 5 forgave such indiscretions :).  If you could open a bug report for me so that I don't forget to fix it, I'll appreciate it (along with other issues that have been recently reported). Thanks.

  • Like 1

Share this post


Link to post
Share on other sites
On 7/20/2017 at 12:38 PM, kongondo said:

Update: Menu Builder Version 0.1.9.

Changelog

  1. Added support for multi-lingual menu items (both PW pages and custom ones)! Thanks @Michael van Laar for 'reminder'.

I'm busy with a multi-lingual site for a client, and this feature doesn't appear to work on my end - I'm getting the error "No menu items found" when switching to the only non-default language.

My menu, called footerNavLeft, is set to use French, and the language tabs are being added to the menu builder (and inheriting default values as expected). When opening the site in English (default language), all is fine. The moment I switch to French, it goves the above-mentioned error.

I'm rendering the menu to my view like this:

$menus = wire('modules')->MarkupMenuBuilder;
$view->menuFooterNavLeft = $menus->render('footerNavLeft', [
    'menu_css_class' => 'menu',
]);

infinitygroupcm_pw.lserv-2017-10-01-17-28-15.screengrab.jpeg.25b227270af4ae500a3c764e21ca2508.jpeg

 

 

---

Edit: Apologies - missed the instructions (which aren't clear in the post quoted above). Using a Page ID works. Though, I hve to ask: why isn't it possible to use a menu name/title in a multi-lingual environment?

Edited by Mike Rockett
Oops!

Share this post


Link to post
Share on other sites
1 hour ago, Mike Rockett said:

Apologies - missed the instructions (which aren't clear in the post quoted above). Using a Page ID works. Though, I hve to ask: why isn't it possible to use a menu name/title in a multi-lingual environment?

Ahem...really Mike? :'(....the docs, Mike, the docs:P

Quote

The first argument is not optional and can be a Page object, a title, name or id of a menu or an array of menu items returned from a menu's menu_items field. Note that for multilingual environments, you cannot pass the method a title or a name; only the other three choices will work. The second argument is an optional array and will fall back to defaults if no user configurations are passed to the method.

Glad you got it sorted :):).

  • Like 1

Share this post


Link to post
Share on other sites
15 minutes ago, kongondo said:

Ahem...really Mike? :'(....the docs, Mike, the docs:P

Glad you got it sorted :):).

Works flawlessly by the way. :-) I haven't perused the source yet, but would it be possible for you to make reference by name/title work, considering that it doesn't change on a per-language basis? 

Share this post


Link to post
Share on other sites
1 minute ago, Mike Rockett said:

would it be possible for you to make reference by name/title work, considering that it doesn't change on a per-language basis? 

I suppose so. I struggle with the ML API to be honest and could do with some help. Do I tell PW to get the page (menu) with the title of the default language? Thanks for any pointers/code, ta.

Share this post


Link to post
Share on other sites
26 minutes ago, kongondo said:

I suppose so. I struggle with the ML API to be honest and could do with some help. Do I tell PW to get the page (menu) with the title of the default language? Thanks for any pointers/code, ta.

I'm no expert either, but I feel the calls made to search for menu pages in MarkupMenuBuilder.module:142-144 are a bit much... On my side, changing it to the following fixes the issue, but I honestly don't know if it breaks anything else...

$menuName = $this->wire('sanitizer')->pageName($menu);
$menu = $this->wire('pages')->get("name=$menuName, template=menus, parent.name=menu-builder, check_access=0");

 

Edited by Mike Rockett
Refer to specific commit for when code changes...

Share this post


Link to post
Share on other sites

Wrapping inner <ul> into div?

thanks for your great module!

With the uikit nav + dropdown i need to wrap an inner <ul> into a <div>. Thats fairly easy with MarkupSimpleNavigation "inner_tpl" but how to do it in this case?

Uikit example:

<a href"#">Menuitem</a>
<div uk-dropdown>
  <ul class="uk-nav uk-dropdown-nav">...</ul>
</div>

thanks!

Share this post


Link to post
Share on other sites
1 hour ago, kater said:

Wrapping inner <ul> into div?

thanks for your great module!

With the uikit nav + dropdown i need to wrap an inner <ul> into a <div>. Thats fairly easy with MarkupSimpleNavigation "inner_tpl" but how to do it in this case?

Menu Builder doesn't support that out of the box, and so you'll need to use getMenuItems(), which allows you to build your menu the way you want it. Here are some gists that could guide you for your menu.

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, kater said:

thanks for your great module!

Glad you like it.

8 hours ago, kater said:

but how to do it in this case?

What Mike said :).

Share this post


Link to post
Share on other sites

Hi @kongondo

I have this setup: 

  • MenuItem1
    • Submenuitem_01( allowed children)
    • SubmenuItem_02 ( allowed children)
  • MenuItem2
    • Submenuitem_03 ( allowed children)
    • SubmenuItem_02 ( allowed children)

I'm using getMenuItems for building my menu, but the issue is that I get children of Submenuitem_02 as children only of the last Submenuitem_02 ( parent_id  =  id of the last Submenuitem_02 ), but I expected that I will get duplications of children pages with right parent_id for every Submenuitem_02

Of course, I can get children in my custom function but I think that in this case, getMenuItems doesn't work as expected and could be improved.

What do you think about it? 

Thanks, Eugene. 

Share this post


Link to post
Share on other sites

Thanks for reporting @Zeka,

This line is the problem. The array index gets overwritten (since duplicate). I'll see what to do.

Share this post


Link to post
Share on other sites

Hi all. 

I am intending to ONLY support ProcessWire 3.x starting from the next version of this module. Please have a read here and let me know what you think. Thanks.

Share this post


Link to post
Share on other sites

I am currently getting a fatal error on a multilanguage site. On the german version, there is no problem, the menu is rendering just as expected, but when I try to open the english or dutch version I am getting the following message:

Error: Exception: No menu items found! Confirm that such a menu exists and that it has menu items. (in /Applications/MAMP/htdocs/cleaninstall/site/modules/ProcessMenuBuilder/MarkupMenuBuilder.module line 959)

#0 /Applications/MAMP/htdocs/cleaninstall/site/modules/ProcessMenuBuilder/MarkupMenuBuilder.module(87): MarkupMenuBuilder->throwError()
#1 /Applications/MAMP/htdocs/cleaninstall/site/templates/partials/header.inc(110): MarkupMenuBuilder->render('main', Object(MenuOptions))
#2 /Applications/MAMP/htdocs/cleaninstall/wire/core/TemplateFile.php(259): require('/Applications/M...')
#3 /Applications/MAMP/htdocs/cleaninstall/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render()
#4 /Applications/MAMP/htdocs/cleaninstall/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___render', Array)
#5 /Applications/MAMP/htdocs/cleaninstall/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array)
#6 

 

The mentioned line 110 of header.inc looks like this: 

<?php
$options = array(
  'menu_css_class' => 'menu-lvl-1',
  'submenu_css_class' => 'menu-lvl-2',
  'current_class' => 'active',
  'has_children_class' => 'has_children',
  'current_class_level' => 3,
  'include_children' => 1
);
?>
<?php echo $menu->render('main', $options); ?>

The Processwire version is 3.0.62 and yes, I already checked if there were menu items in there and I also created another menu to confirm that the error persists.

Share this post


Link to post
Share on other sites
48 minutes ago, thmsnhl said:

I am currently getting a fatal error on a multilanguage site. On the german version, there is no problem, the menu is rendering just as expected, but when I try to open the english or dutch version I am getting the following message:

 

48 minutes ago, thmsnhl said:

<?php echo $menu->render('main', $options); ?>

https://github.com/kongondo/MenuBuilder#api

render()

This method renders a menu/navigation list of a specified menu. The method accepts two arguments/parameters:

render($menu, $options);

The first argument is not optional and can be a Page object, a title, name or id of a menu or an array of menu items returned from a menu's menu_items field. Note that for multilingual environments, you cannot pass the method a title or a name; only the other three choices will work. The second argument is an optional array and will fall back to defaults if no user configurations are passed to the method.

@thmsnhl

That should resolve your issue :).

Edited by kongondo
  • Like 1

Share this post


Link to post
Share on other sites

@kongondo First: thank you for your response and sorry for my delayed reply. I had some other projects crashing my work on that one.

With your help I was able to render the menu also on localized sites. The code now looks like this:

<?php
$options = array(
'menu_css_class' => 'menu-lvl-1',
'submenu_css_class' => 'menu-lvl-2',
'current_class' => 'active',
'has_children_class' => 'has_children',
'current_class_level' => 3,
'include_children' => 1
);
?>
<?php echo $menu->render($pages->get("id=1930"), $options); ?>

But: The menu does not show the localized page titles, those are still German. Am I missing anything else?

 

Edit: I solved it, I just realised that I was missing the following option to translate the titles.

'default_title' => 1

 

  • Like 1

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By jploch
      Hey folks,
      for a module (a pagebuilder based on PageTable) I need to save some settings as JSON. The values are saved for each page table item (a pw page). It's working well, but I am looking for ways to improve the structure I have. As I'm not that experienced with JSON, maybe someone more experienced can take a look and tell me if my approach is good practice. 

      My goal is to make all the items accessible by page id, without looping over them (using objects instead of arrays):
      // access from template with pw page var $jsonObject->items->{$page}->cssClass; Her is an example of my JSON structure:
      { "items": { "3252": { "id": "3252", "cssClass": "pgrid-main", "breakpoints": { "base": { "css": { "grid-column-end": "auto", "grid-row-end": "auto", "grid-column-start": "auto", "grid-row-start": "auto", "align-self": "auto", "z-index": "auto", "padding-left": "60px", "padding-right": "60px", "padding-top": "60px", "padding-bottom": "60px", "background-color": "rgb(255, 255, 255)", "color": "rgb(0, 0, 0)" }, "size": "@media (min-width: 576px)", "name": "base" } } }, "3686": { "id": "3686", "cssClass": "test_global", "breakpoints": { "base": { "css": { "grid-column-end": "-1", "grid-row-end": "span 1", "grid-column-start": "1", "grid-row-start": "auto", "align-self": "auto", "z-index": "auto", "padding-left": "0px", "padding-right": "0px", "padding-top": "0px", "padding-bottom": "0px", "background-color": "rgba(0, 0, 0, 0)", "color": "rgb(0, 0, 0)" }, "size": "@media (min-width: 576px)", "name": "base" } } }, "3687": { "id": "3687", "cssClass": "block_editor-3687", "breakpoints": { "base": { "css": { "grid-column-end": "span 2", "grid-row-end": "span 1", "grid-column-start": "auto", "grid-row-start": "auto", "align-self": "auto", "z-index": "auto", "padding-left": "0px", "padding-right": "0px", "padding-top": "0px", "padding-bottom": "0px", "background-color": "rgba(0, 0, 0, 0)", "color": "rgb(0, 0, 0)" }, "size": "@media (min-width: 576px)", "name": "base" } } }, "3696": { "id": "3696", "cssClass": "block_editor-3696", "breakpoints": { "base": { "css": { "grid-column-end": "span 2", "grid-row-end": "span 1", "grid-column-start": "auto", "grid-row-start": "auto", "align-self": "auto", "z-index": "auto", "padding-left": "0px", "padding-right": "0px", "padding-top": "0px", "padding-bottom": "0px", "background-color": "rgba(0, 0, 0, 0)", "color": "rgb(0, 0, 0)" }, "size": "@media (min-width: 576px)", "name": "base" } } } }, "breakpointActive": "base", "breakpointActiveSize": "@media (min-width: 576px)" }  
    • By jploch
      Fieldtype Page Table Grid
      This is a sneak preview of a side project I've been working on for quite some time now. A lot of work and thought has gone into this, so I will most likely release this as a commercial module at some point in the near future. 

      As a designer (and developer) I get the appeal of a WYSIWYG editor. After playing around with some WYSIWYG page builder tools, I always felt something was wrong about them. So I decided to build my own PW version based on PageTable.

      Here is a small demo (using AdminThemeCanvas, but its working with other admin themes as well) :
      There is also a complete website that I built for a friend of mine using this module and some custom blocks.
      Concept
      This fieldtype shares a lot of features with PageTableExtended: it's also an extension of PageTable and renders the block templates in the backend and frontend (native PW templates and fields). You can also add your own css via module settings.
      The difference is, this fieldtype also gives you the ability to rearrange and resize elements in a visual way as well as enable inline editing for text, ckeditor and file fields. Similar (and promising) attempts have been made, but I wanted something based on native CSS grid instead of a CSS framework...so I built my own version. Most CSS frameworks are based on flexbox, which is great for layouting elements horizontally. With CSS grid, you can place elements horizontally and vertically, allowing for layouts that were not previously possible with CSS. Similar to webflow, this fieldtype uses javascript (in the backend) to let you manipulate CSS grid in a visual way to design fully responsive websites (or parts of them). It should still be possible to include a CSS framework if you like (just add the classes to your block markup and include the CSS via module settings).
      The CSS grid layout manipulations are saved in a single field as a JSON array and used to generate a dynamic stylesheet that you simply include in your main template (no inline styles). The styles are saved within the breakpoint you select and cascade down to smaller breakpoints. That means you can specify just the basic breakpoint and adjust other breakpoints if needed. The exception is the mobile breakpoint which will display everything in one column as a default (you can change the layout here too).
      The fieldtype also comes with an optional style panel to manipulate some additional CSS properties directly on the page. You can customize the panel or disable it completely from the module settings (and just use a CSS file that you include via module settings). The style panel is based on inputfields (nothing is saved to the database). This means that you just have to install the module and all fields are available to all blocks automatically (this can be customized). It also has the benefit that your installation is not flooded with fields; this module only installs one field.
      Don't want to give your customer all that power? Design features can be disabled for certain roles. The grid editor role can just edit the content and use the inline editing feature to edit content quickly. You can then also grant access individually to the style panel, resize or drag functionality.
      Features
      Blocks are just pages Blocks are defined by native PW templates and fields Manipulate CSS grid in a visual way to design fully responsive websites (or parts of them) Design features can be disabled for certain roles Inline editing of text, ckeditor and file fields The layout is 100% CSS grid (very small css file size) Simply drag and resize to manipulate grid items directly inside the backend Manipulate grid columns and rows directly on the page (use any number of columns you want) All style manipulations are saved as JSON and used to generate a dynamic stylesheet that you just include in your main template (no inline styles) Nested groups/grids (child pages of nested blocks are created under group parent) Global blocks work with page reference field (changes on one page, changes all blocks on all pages) Manual and auto placement of grid items Define custom icons for your blocks via native template settings (template -> advanced -> icon) Option to load lazysizes in the backend to enable lazy loading of assets with class lazyload Works with all default and ui-kit based admin themes If you have any questions or feedback, let me know.
    • By bernhard
      I built this module because I needed a versatile solution to replace tags and simple if-blocks in some E-Mails and PDF documents.
      If you only need to replace static tags (no if-conditions), then you can use default PW api and need no module:
      $str = "My favourite color is {color}."; $texttools = $sanitizer->getTextTools(); echo $texttools->populatePlaceholders($str, ['color' => 'red']); // output: My favourite color is red. Usage:
      See the two example Files in the folder /replacements

       
      Methods:
      replacementsTable()
      Renders an overview of all available replacements (see the example in the Module's config file:
       
      Create new Replacements:
      Simply copy the sample file and adopt to your needs.
       
      Download:
      https://gitlab.com/baumrock/RockReplacer
    • By bernhard
      DEPRECATED
      I'm using this module in several projects, but it will likely not see any updates in the future. I'm not happy with it and I'm looking for ways to develop better solutions. RockTabulator was my first try, but I'm also not 100% happy with that. The tabulator library is great, but my module implementation is not. I hope to get a good solution soon, but it will be a lot of work...
      ---
      Some of you might have followed the development of this module here: https://processwire.com/talk/topic/15524-previewdiscussion-rockdatatables/ . It is the successor of "RockDataTables" and requires RockFinder to get the data for the grid easily and efficiently. It uses the open source part of agGrid for grid rendering.
       
      WHY?
      ProcessWire is awesome for creating all kinds of custom backend applications, but where it is not so awesome in my opinion is when it comes to listing this data. Of course we have the built in page lister and we have ListerPro, but none of that solutions is capable of properly displaying large amounts of data, for example lists of revenues, aggregations, quick and easy sorts by the user, instant filter and those kind of features. RockGrid to the rescue 😉 
       
      Features/Highlights:
      100k+ rows Instant (client side) filter, search, sort (different sort based on data type, eg "lower/greater than" for numbers, "contains" for strings) extendable via plugins (available plugins at the moment: fullscreen, csv export, reload, batch-processing of data, column sum/statistics, row selection) all the agGrid features (cell renderers, cell styling, pagination, column grouping etc) vanilla javascript, backend and frontend support (though not all plugins are working on the frontend yet and I don't plan to support it as long as I don't need it myself)  
      Limitations:
      While there is an option to retrieve data via AJAX the actual processing of the grid (displaying, filtering, sorting) is done on the client side, meaning that you can get into troubles when handling really large datasets of several thousands of rows. agGrid should be one of the most performant grid options in the world (see the official example page with a 100k row example) and does a lot to prevent problems (such as virtual row rendering), but you should always have this limitation in mind as this is a major difference to the available lister options that do not have this limitation.
      Currently it only supports AdminThemeUikit and I don't plan to support any other admin theme.
       
      Download: https://gitlab.com/baumrock/FieldtypeRockGrid
      Installation: https://gitlab.com/baumrock/RockGrid/wikis/Installation
      Quikckstart: https://gitlab.com/baumrock/RockGrid/wikis/quickstart
      Further instructions: https://gitlab.com/baumrock/RockGrid/wikis/quickstart#further-instructions
      German Translation File: site--modules--fieldtyperockgrid--fieldtyperockgrid-module-php.json
      Changelog: https://gitlab.com/baumrock/FieldtypeRockGrid/raw/master/changelog.md
       
      Module status: alpha, License: MIT
      Note that every installation and uninstallation sends an anonymous google analytics event to my google analytics account. If you don't want that feel free to remove the appropriate lines of code before installation/uninstallation.
       
      Contribute:
      You can contribute to the development of this and other modules or just say thank you by
      testing, reporting issues and making PRs at gitlab liking this post buying me a drink: paypal.me/baumrock/5 liking my facebook page: facebook.com/baumrock hiring me for pw work: baumrock.com  
      Support: Please note that this module might not be as easy and plug&play as many other modules. It needs a good understanding of agGrid (and JavaScript in general) and it likely needs some looks into the code to get all the options. Please understand that I can not provide free support for every request here in the forum. I try to answer all questions that might also help others or that might improve the module but for individual requests I offer paid support (please contact me via PM).
       
      Use Cases / Examples:
      Colored grid cells, Icons, Links etc. The Grid also has a "batcher" feature built in that helps communicating with the server via AJAX and managing resource intensive tasks in batches:

      Filters, PW panel links and instant reload on panel close:

      You can combine the grid with a chart library like I did with the (outdated) RockDataTables module:

    • By Paul Greinke
      Hi there. I wrote a custom module for one of my projects. In fact I maybe want to use my module in other projects too. In order to be variable and customizable  I need to implement some custom hooks into my module. So I can afterwards hook into the my functions in order to modify them to match the needs of the new project.
      I tried simply defining functions with the '__' prefix. But that did not work. I'm imagining something like the following:
      <?php class MyClass { public function ___someFunction() { // Do something } } // ready.php $this->addHookBefore('MyClass::someFunction', function($event) { // some customization }); Is there a way to accomplish that? 
×
×
  • Create New...