function dispSection = getDisplaySection(pkgName,objName,title,props,redirectList)
% This is an internal function and may be removed in the future
%
% dispSection = getDisplaySection(pkgName, objName, title, propNames, redirectList)
% returns the display description required for Simulink block display of a
% system object.
%	pkgName - the name of the package, e.g., driving
%	objName - the name of the system object, e.g., multiObjectTracker
%	title	- the title of the display section, e.g, TrackerManagement
%	propName - the name of the property, e.g., FilterInitializationFcn
%	redirectList - an M-by-2 cell array with prop number and objName, e.g. {2,'SimulinkBusUtilities'}
%
% Notes: 
%	1. The resource file corresponding to pkgName:objName must have an
%	   entry key with name ['Title',title], e.g., TitleTrackerManagement,
%	   except when title is empty, ''
%	2. The resource file corresponding to pkgName:objName must have an 
%	   entry key with name ['Prop',propName], e.g., PropFilterInitializationFcn

% Copyright 2017 The MathWorks, Inc.
propsList = cell(1,numel(props));
if nargin<5
	redirectInds = [];
else
	redirectInds = [redirectList{:,1}];
end
for i = 1:numel(props)
    thisProp = props{i};
    if isa(thisProp,'matlab.system.display.internal.Property')
        propsList{i} = thisProp;
    else
        if isempty(redirectInds) || ~any(redirectInds==i)
            propsList{i} = matlabshared.tracking.internal.getPropertyDescription(....
                pkgName,objName,thisProp);
        else
            ind = find(redirectInds==i);
            propsList{i} = matlabshared.tracking.internal.getPropertyDescription(...
                pkgName,redirectList{ind,2},thisProp);
        end
    end
end
if isempty(title)
    titleMsg = '';
else
    titleMsgID = [pkgName,':',objName,':Title',title];
    titleMsg = getString(message(titleMsgID));
end
dispSection = matlab.system.display.Section('Title',titleMsg,'PropertyList',propsList);