[FacebookBridge] Add option to limit number of returned items

This commit adds a new optional parameter 'limit' which can be used
to limit the number of items returned by this bridge (i.e. '&limit=10')

As requested in #669
This commit is contained in:
logmanoriginal 2018-10-15 17:33:19 +02:00
parent b90bcee1fc
commit 5779f641c0

View file

@ -41,6 +41,15 @@ class FacebookBridge extends BridgeAbstract {
'exampleValue' => 'https://www.facebook.com/groups/743149642484225',
'title' => 'Insert group name or facebook group URL'
)
),
'global' => array(
'limit' => array(
'name' => 'Limit',
'type' => 'number',
'required' => false,
'title' => 'Specify the number of items to return (default: -1)',
'defaultValue' => -1
)
)
);
@ -117,6 +126,12 @@ class FacebookBridge extends BridgeAbstract {
}
$limit = $this->getInput('limit') ?: -1;
if($limit > 0 && count($this->items) > $limit) {
$this->items = array_slice($this->items, 0, $limit);
}
}
#region Group