Sorry, I posted to quickly, but I hope you got my point.
For such new features that just add some small behavior to the core one, I 
do not want to have a function that I will need to update each time the 
core changes. Therefore, I modify the core and process a diff/merge at each 
new release to keep my small addition AND your new code without the need to 
change my code.

Cheers,
Tiffany

Le vendredi 3 octobre 2014 11:49:21 UTC+2, Tiffany Grenier a écrit :
>
> I'm quite happy that you like my suggestions :-)
>
> The main reason why I'm NOT doing a webhook, is that I might WANT to be 
> affected by core changes... If functions did not start by checking for a 
> webhook to run instead, I might have wrote a function doing something like:
> function myBOLTFbreadcrumb($args, $zone='') {
>     $normalResult = BOLTFbreadcrumb($args, $zone);
>     if(I do not want o stick to the normal result)
>  and return $normalResult
>    return $myChangedResult
> }
>
> Cheers,
> Tiffany
>
> Le jeudi 2 octobre 2014 18:58:04 UTC+2, Dan a écrit :
>>
>> Wow some great suggestions...
>>
>> BREADCRUMB
>> Here's how you could have done the modified breadcrumb function as a 
>> plugin. You would either put this in config.php or a custom plugin that you 
>> enable for your site. 
>>
>> $BOLTtoolmap['f']['breadcrumb'] = 'myBOLTFbreadcrumb';
>>
>> function myBOLTFbreadcrumb($args, $zone='') {
>> // your modified version of the system function
>> }
>>
>> Basically when BoltWire is called to generate a breadcrumb, it sees the 
>> toolmapping value and calls your function rather than mine. The advantage 
>> to this approach, is you never have to worry about your changes to the core 
>> code being overwritten during an upgrade. My goal is always to enable you 
>> to do anything without ever having to hack the core.
>>
>> SEARCHPAGELIST
>> Unfortunately, the BOLTsearchPageList function does not have a webhook. 
>> So to let you customize this function, I would normally add one, by 
>> inserting this line at the very top of the system function:
>>
>> function BOLTsearchPageList($args, $zone='', $auth=true) {
>> if (function_exists('myBOLTsearchPageList')) return 
>> myBOLTsearchPageList($args, $zone='', $auth=true);
>> ...
>>
>> You could then copy the system function to your config.php file or 
>> plugin, renamed it myBOLTsearchPageList, and your function would be used 
>> instead of mine. The goal again is to make it possible to do anything 
>> without hacking the core.
>>
>> In this case however, I like both your suggestions and will add them to 
>> the next release. The second one is particularly elegant. Will update the 
>> docs.
>>
>> Cheers,
>> Dan
>>
>>
>>
>>
>> On Thu, Oct 2, 2014 at 1:39 AM, Tiffany Grenier <[email protected]> 
>> wrote:
>>
>>> Hi,
>>>
>>> I don't know if this might be of interest for someone, or even be 
>>> integrated into the core at some point, but I created a hooks 
>>> for BOLTFbreadcrumb and BOLTsearchPageList, allowing you the following 
>>> things:
>>>
>>>    - add an argument limit to breadcrumb, in order to display only N 
>>>    items (+ the final one if there are more than N page levels)
>>>    - add argument final (by default "...") to breadcrumb that tells 
>>>    what should be placed between seperators instead of the "hidden" levels, 
>>>    thus between item N and N+1 if there is a N+1 (as you can see in 
>>> attached 
>>>    picture, where limit is 3)
>>>    - add the possibility to search for group=page.+ (or group=page+, or 
>>>    group=page.+.+.+) in addition to group=page.*, in order to be able to 
>>> limit 
>>>    the number of levels we want to search for, without having to use 
>>> patterns
>>>
>>>
>>> How to do it? For each method, just copy-paste current code into a hook 
>>> and apply following patches to the hook methods:
>>>
>>>    - BOLTFbreadcrumb (file functions.php)
>>>    - between lines 29 and 30, add:
>>>          - $lastseparator = $separator.BOLTinit('...', 
>>>          $args['final']).$separator;
>>>       - between old lines 48 and 49 - therefore between new lines 49 
>>>       and 50 -, add:
>>>          - $outlast = '';
>>>            if ((isset($args['limit'])) && ((isset($args['offset'])) && 
>>>          (($args['limit']+$args['offset']) <= $last) || ($args['limit'] <= 
>>> $last))) {
>>>            if (isset($out[$last])){
>>>            if((isset($args['offset'])) && 
>>>          (($args['limit']+$args['offset']) == $last) || ($args['limit'] == 
>>> $last)) 
>>>          $lastseparator=$separator;
>>>            $outlast = $out[$last];
>>>            unset($out[$last]);
>>>            }
>>>            }
>>>       - between old lines 49 and 50 - therefore between new lines 58 
>>>       and 59 - , add:
>>>          - if (isset($args['limit']))  $out = array_slice($out, 0, 
>>>          $args['limit']);
>>>       - before the return, add:
>>>          - if($outlast != '') $out = $out.$lastseparator.$outlast;
>>>          - BOLTsearchPageList (file library.php)
>>>    - replace line 1634 by:
>>>          - if (strpos($p, "*") !== false || strpos($p, "+") !== false) {
>>>          - between lines 1638 and 1639, add:
>>>          - $p = str_replace('+', "[$namespat]*", $p);
>>>       
>>>
>>> That's it!
>>> That's not really a recipe, nor a plugin, so I didn't know where to put 
>>> it in the website documentation...
>>>
>>> Regards,
>>> Tiffany
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "BoltWire" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/boltwire.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/boltwire.
For more options, visit https://groups.google.com/d/optout.

Reply via email to