When we create a model and upload a swagger file and render and publish it, a corresponding smartdoc view gets created with setting of displaying no of items as 5.
Steps to reproduce : Content → SmartDocs → New model → Add model name → create model →
Structure → Views → select your API method listing → Edit → you will see limit is set to 5.
Instead of changing each APIs method listing views setting, we should be able to produce views with customised limit of no. of items to display.
I have also tested by changing settings of base method listing view of smartdoc, but that is also not helping in creating views with customised limit values.
I am afraid, as of today when creating a new view, it picks up settings from module code instead of view database. Ideally, As you said, it has to pick up settings from overridden base view while creating SmartDocs Views Listing page.
You need to update those settings manually today & it will be one-time update.
@Chris Novak , @Daniel Johnson What do you think about same ?
Anil’s answer is correct, the SmartDocs module should pick up the overridden view. I put in an issue for the development team to add this fix, but for now you will need to modify each new API view individually.
@Vishal Bhatnagar , It’s not a good idea to directly change database values. It will lead to fatal errors & you will bypass drupal system. Any reason why you are not using UI to update the values ?
Hi @Anil Sagar, We have even more than 100 views to update, manually changing values for all would be tedious, therefore thought by updating all view’s value at once using db update.
You can achieve same with simple hook & custom module. See details below. For more information check here.
/*
* Implementation of hook_views_pre_build().
*/
function YOURMODULENAME_views_pre_build(&$view){
// Make sure this is only for smartdocs related views
if (CONDITION TO MATCH ALL SMARTDOCS VIEWS) {
// Now lets set the pager item to what ever out count is.
$view->pager['items_per_page'] = 10;
}
}
This fix did not make it into the June 16 release because with a very small number of exceptions that was a security hotfix release rather than a bugfix/feature release. We are planning a new feature/bugfix release soon (exact date TBA) which will include this fix. Unfortunately it did not make it into the recent on-prem release either.