mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 17:45:40 +03:00
[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:
parent
b90bcee1fc
commit
5779f641c0
1 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue