lookForSquarePanels method

List<KnowledgePanel> lookForSquarePanels(
  1. Product product
)

Implementation

List<KnowledgePanel> lookForSquarePanels(Product product) {
  if (elementType == KnowledgePanelElementType.PANEL_GROUP) {
    final List<String>? panelIds = panelGroupElement?.panelIds;
    final List<KnowledgePanel> result = <KnowledgePanel>[];

    for (final String panelId in panelIds ?? <String>[]) {
      final KnowledgePanel? panel = KnowledgePanelsBuilder.getKnowledgePanel(
        product,
        panelId,
      );

      if (panel == null) {
        continue;
      }

      result.addAll(panel.getSquarePanels(product));
    }

    return result;
  }

  final KnowledgePanel? panel = KnowledgePanelsBuilder.getKnowledgePanel(
    product,
    panelElement?.panelId ?? '',
  );

  if (panel == null) {
    return <KnowledgePanel>[];
  }

  return panel.getSquarePanels(product);
}