Jump to content

Macrura

PW-Moderators
  • Posts

    2,776
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Macrura

  1. right, i will check the database shortly... i've spent some hours looking at other modules including the menu builder, to try and figure out how to get a page list select to work for module setting...
  2. many thanks - but i can't seem to get the module to save the selected page; it shows the field but it reverts to unselection after you hit submit..
  3. Hi - i have a module i'm trying to improve so i added a page list select to the getModuleConfigInputfields function like this: $fieldDocsRoot = wire('modules')->get('InputfieldPageListSelect'); $fieldDocsRoot->attr('name+id', 'docsRoot'); $fieldDocsRoot->label = __('Docs Root', __FILE__); $fieldDocsRoot->description = __('Select the root page of your docs. (Allows the module to know where to create new docs.', __FILE__); $fieldDocsRoot->attr('title', __('Docs root', __FILE__)); $wrapper->add($fieldDocsRoot); i also tried to init the docRoot var up in __construct, but i can't figure out how to get it to save the page on that inputfield.. TIA
  4. @Jon - the wire class can be used inside functions - so in the case of Joss' issue, he wanted the solution to be in a function. when outside of a function like in a template you can use the $pages variable directly...
  5. sorry, yeah that was a profields; removed it now...not super relevant anyway
  6. yes, there is an extensive discussion of that here, with code of how to achieve that: https://processwire.com/talk/topic/4991-sub-arrays-dates-times-and-pure-hell/ other options: https://processwire.com/talk/topic/6733-better-way-to-finding-all-years/#entry65975 https://processwire.com/talk/topic/11690-display-results-with-a-year-heading-using-datetime-field/?p=108709
  7. maybe you need this instead of the foreach $out .= "<img src='{$item->images->first()->url}' />";
  8. to answer mrkhan's query regarding the way my setup for this example is, here is the screenshot of the table that generates the menu: @clsource - your example is also the same as what is discussed in depth in my last link provided in my prior post; which has the same features/setup. Visitors looking at this thread may want to visit that topic because it also provides the comprehensive code to output the markup for such a setup.
  9. my setup and that function is really only for simple sites needing only 2 levels; also for the way i have it setup i'm using a table, but it should work with any wirearray. in your case it seems that you may be better off using MSN, or Menu builder, or even a separate branch of the page tree which can generate an MSN menu but specifying a root page argument, and then overriding the URL to be the page select instead of the virtual menu page/node. there are a lot of posts on this forum with recursive functions for making menus of all kinds, from all different types of sources, be it the page tree, a menu tree, or repeaters; here are some: https://processwire.com/talk/topic/9033-mega-menu/?hl=%2Bnested+%2Bmenu#entry87159 https://processwire.com/talk/topic/8544-want-to-create-a-custom-menu/?hl=%2Bnested+%2Bmenu#entry82687 https://processwire.com/talk/topic/3650-multi-level-menu/?hl=%2Bnested+%2Bmenu https://processwire.com/talk/topic/2787-custom-menu-not-related-to-page-tree/?hl=%2Bnested+%2Bmenu
  10. sure - here's the function - you'd need to have fields for menu_group (checkbox), menu_page (page select) and menu_href (url) which overrides page select; in this case you also need to set the href as a # for the parent items, but you could change this probably function semanticNav($field) { $page = wire('page'); $menu = $field; $out = ''; $group = false; foreach($menu as $item) { $class = ''; // if this item is not in a group, but group is true from previous // item, close the ul /li now: if($item->menu_group != 1 && $group) $out .= "</ul>\n</li>\n"; $url = ''; if($item->menu_page->id) $url = $item->menu_page->url; if($item->menu_href) $url = $item->menu_href; if($item->menu_page->id == $page->rootParent->id) $class = " class='current'"; if($item->menu_group == 1 && $item->menu_href == '#') { $out .= "<li class=\"dropdown\">\n"; $out .= "\t<a href='#' class='dropdown-toggle' data-toggle='dropdown'>$item->menu_title</a>\n"; $out .= "\t\t<ul class=\"dropdown-menu\">\n"; $group = true; } // Sub items if($item->menu_group == 1 && $item->menu_page->id) { $out .= "\t<li{$class}><a href='$url'>$item->menu_title</a></li>\n"; $group = true; } // Regular Items: if($item->menu_group != 1 && $item->menu_page->id) { $out .= "\t<li{$class}><a href='$url'>$item->menu_title</a></li>\n"; $group = false; } } return $out; }
  11. yes, sometimes for simple sites i do something like this (usually use a table, but repeater should work); i'm not sure about depth - seems maybe unnecessary; i usually have a checkbox called child which simply makes the current row/repeater a child of the previous non-child item in the order that the items appear in... also i think you can maybe use this shorter ternary syntax if you are using the code above $prev = $item->prev->depth ?: 0; $next = $item->next->depth ?: 0;
  12. FYI i simply copied the stock module from 2.7 and then swapped out the js file, added the css; i didn't try and use the module from devns, though i'm not sure if that matters; the assumption is that eventually the new version of the datetime field would allow you to configure the settings, e.g. sliders vs. selects. also i have not tested this with form builder, and since your post is in general support, the assumption is that this relates to the stock admin; for formbuilder support i would recommend posting in that private forum.
  13. i'm using the updated timepicker and it works fine so far - you would want to duplicate the inputfield (datetime) into your site directory and then tell PW to use that one; from there you can make your changes... (like to the CSS file) you may also need to add something like this to your admin custom files (ProcessPageEdit.js) if(typeof $.timepicker != 'undefined') { $(function(){ $.timepicker.custom = { stepMinute: 15, controlType: 'select', oneLine: true, }; $.timepicker.setDefaults($.timepicker.custom); }); } word is that the next version of PW will have the updated timepicker addon
  14. some of these might be applicable: https://processwire.com/talk/topic/9486-movie-website-session-times-by-day/ https://processwire.com/talk/topic/4991-sub-arrays-dates-times-and-pure-hell/ also sometimes i avoid having to use the array_unique by using the value as the key
  15. yeah, like this insanity: https://developer.joomla.org/security-centre/630-20151214-core-remote-code-execution-vulnerability.html
  16. the page tree is hidden, you can go find the page under admin, and unlock it, then un-hide it; i'm not sure why it is hidden by default, but once you un-hide it i think it should stay un-hidden.
  17. it might work, but you could also try page table - might be a little cleaner UI
  18. awesome, many thanks for this! will be upgrading mods tomorrow...
  19. can you post your version; i'm assuming this is a fresh install and you are running the minimum requirements for Apache, MySQL and PHP?
  20. In relation to lister - So i have this module generating a dynamic link (the link is based off the combination of a page select and some attributes of the page being edited); to get it to work in lister, e.g. where it doesn't end up getting entity encoded, i added this to ready.php: wire()->addHookAfter('FieldtypeRuntimeMarkup::markupValue', function($event) { $value = $event->arguments('value'); $event->return = $value; }); should the module assume that the output will be markup and therefore also provide a markupValue by default, or leave this up to the user to add as a hook?
  21. @Martijn - thanks - that's very cool. I like the idea of the label - so i'm going to see about integrating your version into my current project's settings table... It is definitely more user friendly to have the label - some clients put wrong stuff into value because they only see the variable name and sort of don't get it. Also in newer versions of my settings i have an options column, which inside i can place pipe-delimited options, such as enabled|disabled, or true|false, or on|off; then in the value row, when you click into the cell, it brings up a select; this helps to control the spelling and to also remind people of what sort of values are acceptable for the field. To achieve this i'm using a commercial jQuery plugin called Pickle, which lets you create a select out of any text input;(if i could find a non-commercial plugin that did the same thing i would post the instructions here)
  22. @kongondo - thanks - yes, i could also just delete and remake the field, since i can copy the code, and there is no risk of losing entered data... it would be good to fix though, as surely someone along the way is going to try and rename one of these..
  23. @kongondo - wondering if there might be an issue with renaming fields using this fieldtype; i tried renaming an existing field but got a sql error;
  24. how about wordLimiter? i have this in every single site.
  25. great - i was planning a write up/tutorial on various ways to do menus on PW; historically i've done it using a lot of different ways (besides the usual generating from the page tree); for some simple sites now i use a profields table, now that it supports page selects. but i do think the menu builder is the best for larger sites; let me know if you need any help on it, i can donate time over the next 2 months.
×
×
  • Create New...