Hi Dan,
I understand what you would like me to do, but I have to warn you that most
of the time, I will not do it your way... Because there are times when I do
NOT want to see some new feature disabled because I did not update all my
plugins according to your changes.
If the code allowed me to do the following, I would not hesitate one second:
function myBOLTFbreadcrumb($args, $zone='') {
$normalResult = BOLTFbreadcrumb($args, $zone='');
if( some case where I do not want to get limited by default behaviour) {
$myResult = ...
return $myResult;
}
return $normalResult;
}
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 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]
> <javascript:>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> 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.