Jump to content

Search the Community

Showing results for tags 'depth'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 3 results

  1. This module fulfills a need that's perhaps not common but there have been some requests for it in the past. There's an open request in the requests repo so the features might get added to the core at some point but for now here's a module for anyone who needs it. PageFinder Depth Adds the ability to find and sort pages by the depth of the page relative to the home page. The module requires that the core PagePaths module is installed. Depth of a page in this case means the same thing as "number of parents", so a page that is directly under the home page has a depth of 1, and a child of that page has a depth of 2, and so on. If you already have a Page object you can get its depth with $page->numParents() but the result of this isn't searchable in a PageFinder selector. Installing this module allows you to use selectors like this: $items = $pages->find("depth=2"); $items = $pages->find("template=basic-page, depth>1, depth<4"); $items = $pages->find("template=product, sort=depth"); The keyword "depth" is configurable in the module settings so you can change it to something different if you already have a field named "depth" that the default keyword would clash with. Limitations OR-group selectors are not supported for depth. Searching by depth in an existing PageArray This module only adds features for PageFinder selectors and doesn't automatically add any depth property to Page objects in memory, but you can search within a PageArray using numParents to achieve the same thing, e.g. $items = $my_pagearray->find("template=basic-page, numParents>1, numParents<4"); https://github.com/Toutouwai/PageFinderDepth
  2. This is a module I made as an experiment a while ago and never got around to releasing publicly. At the time it was prompted by discussions around using Repeater fields for "page builder" purposes, where the depth feature could possibly be used for elements that would be nested inside other elements. I thought it would be useful to enforce some depth rules and translate the depth data into a multi-dimensional array structure. I'm not using this module anywhere myself but maybe it's useful to somebody. Repeater Depth Helper This module does two things relating to Repeater fields that have the "Item depth" option enabled: It enforces some depth rules for Repeater fields on save. Those rules are: The first item must have a depth of zero. Each item depth must not be more than one greater than previous item depth. It provides a RepeaterPageArray::getDepthStructure helper method that returns a nested depth structure for a Repeater field value. Helper method The module adds a RepeaterPageArray::getDepthStructure method that returns a multi-dimensional array where the key is the page ID and the value is an array of nested "child" items, or null if there are no nested children. Example The module doesn't make any assumptions about how you might want to use the depth structure array, but here is a way you might use it to output a nested unordered list. // Output a nested unordered list from a depth structure array function outputNestedList($depth_structure, $repeater_items) { $out = "<ul>"; foreach($depth_structure as $page_id => $nested_children) { $out .= "<li>" . $repeater_items->get("id=$page_id")->title; // Go recursive if there are nested children if(is_array($nested_children)) $out .= outputNestedList($nested_children, $repeater_items); $out .= "</li>"; } $out .= "</ul>"; return $out; } $repeater_items = $page->my_repeater; $depth_structure = $repeater_items->getDepthStructure(); echo outputNestedList($depth_structure, $repeater_items); https://github.com/Toutouwai/RepeaterDepthHelper https://modules.processwire.com/modules/repeater-depth-helper/
  3. Hey Guys, Looking for a little help with working with the depth feature on the Repeater Matrix. I am working on building a page builder similar to the one discussed here: https://github.com/ryancramerdesign/ProcessWire/issues/1906. I am having a hard time looping over the Repeater Matrix and each item at each depth and combining them into a single array to present to the UI. The reason I am trying to push this to an array is because I am converting it to JSON for various Vuejs components that need to be supported. The structure of the "Builder" is: section: depth 0 - has various options that can be applied to a section of page( background image/color etc...) container: depth 1 row: depth 2 column: depth 3 - has various options for different widths for the column being set up. custom components: depth 4 - CKEditor, slider, whatever custom component that is needed Hopefully I am making sense explaining this. Any help would be greatly appreciated. Thanks Ya'll! Kyle
×
×
  • Create New...