Return all substitutes from contextual View (already loaded WidgetMaps)
Ideally must return only one WidgetMap per View.

@return WidgetMap[]
11591
public function getContextualSubstitutes()
    {
        $substitutesWidgetMaps = [];
        $viewWidgetMaps = $this->getContextualView()->getWidgetMapsForViewAndTemplates();

        foreach ($viewWidgetMaps as $viewWidgetMap) {
            if ($viewWidgetMap->getReplaced() == $this) {
                $substitutesWidgetMaps[] = $viewWidgetMap;
            }
        }

        return $substitutesWidgetMaps;
    }
1065140
public function updateWidgetMap($widgetMap)
    {
        //parse all widfgetMaps
        foreach ($this->widgetMaps as $key => $_widgetMap) {
            //if this the widgetMap we are looking for
            if ($_widgetMap->getWidgetId() === $widgetMap->getWidgetId()) {
                $this->widgetMaps[$key] = $widgetMap;
                //there no need to continue, we found the slot
                break;
            }
        }

        return $this;
    }
1151740
protected function getChildrenByView(WidgetMap $widgetMap)
    {
        $beforeChilds = $widgetMap->getContextualChildren(WidgetMap::POSITION_BEFORE);
        $afterChilds = $widgetMap->getContextualChildren(WidgetMap::POSITION_AFTER);

        $childrenByView['views'] = [];
        $childrenByView['before'] = [];
        $childrenByView['after'] = [];
        foreach ($beforeChilds as $beforeChild) {
            $view = $beforeChild->getView();
            $childrenByView['views'][] = $view;
            $childrenByView['before'][$view->getId()] = $beforeChild;
        }
        foreach ($afterChilds as $afterChild) {
            $view = $afterChild->getView();
            $childrenByView['views'][] = $view;
            $childrenByView['after'][$view->getId()] = $afterChild;
        }

        return $childrenByView;
    }
503570
private Map<Contextual<?>, Object> getComponentInstanceMap()
   {
      ConcurrentHashMap<Contextual<?>, Object> map = (ConcurrentHashMap<Contextual<?>, Object>) getCurrentContext()
               .getAttributeMap().get(COMPONENT_MAP_NAME);
      if (map == null)
      {
         map = new ConcurrentHashMap<Contextual<?>, Object>();
         getCurrentContext().getAttributeMap().put(COMPONENT_MAP_NAME, map);
      }
      return map;
   }
311924
public static function getNameMap(): array
    {
        if (self::$nameMap === null) {
            self::$nameMap = [];
            $countries     = self::getLoader()->all();

            foreach ($countries as $country) {
                self::$nameMap[$country['alpha2']] = $country['name'];
            }

            self::$alpha2CodeMap = array_flip(self::$nameMap);
        }

        return self::$nameMap;
    }
881321
public function getMappings()
    {
        if ($this->mappings === null) {
            $this->mappings = new Mappings($this->data['mappings'], $this);
        }
        return $this->mappings;
    }
1105706
public function mapOptions()
    {
        if ($this->mapOptions === null) {
            $this->mapOptions = $this->defaultMapOptions();
        }
        return $this->mapOptions;
    }
484970
public function getMappings()
    {
        if (isset($this->_mappings)) {
            return $this->_mappings;
        }

        $this->_mappings = array();

        $generatedLine = 1;
        $previousGeneratedColumn = 0;
        $previousOriginalLine = 0;
        $previousOriginalColumn = 0;
        $previousSource = 0;
        $previousName = 0;

        $str = $this->_map->mappings;
        $end = strlen($str);
        $pos = 0;

        while ($pos < $end) {
            if ($str[$pos] === ';') {
                $generatedLine++;
                $pos++;
                $previousGeneratedColumn = 0;
            } else if ($str[$pos] === ',') {
                $pos++;
            } else {
                $mapping = array();
                $mapping['generatedLine'] = $generatedLine;

                // Generated column.
                $value = Kwf_SourceMaps_Base64VLQ::decodePos($str, $pos);
                $mapping['generatedColumn'] = $previousGeneratedColumn + $value;
                $previousGeneratedColumn = $mapping['generatedColumn'];

                if ($pos < $end && !($str[$pos]==',' || $str[$pos]==';')) {
                    // Original source.
                    $value = Kwf_SourceMaps_Base64VLQ::decodePos($str, $pos);
                    $mapping['originalSource'] = (isset($this->_map->sourceRoot) ? $this->_map->sourceRoot.'/' : '')
                                                  . $this->_map->sources[$previousSource + $value];
                    $previousSource += $value;
                    if ($pos >= $end || ($str[$pos]==',' || $str[$pos]==';')) {
                        throw new Exception('Found a source, but no line and column');
                    }

                    // Original line.
                    $value = Kwf_SourceMaps_Base64VLQ::decodePos($str, $pos);
                    $mapping['originalLine'] = $previousOriginalLine + $value;
                    $previousOriginalLine = $mapping['originalLine'];
                    // Lines are stored 0-based
                    $mapping['originalLine'] += 1;
                    if ($pos >= $end || ($str[$pos] == ',' || $str[$pos] == ';')) {
                        throw new Exception('Found a source and line, but no column');
                    }

                    // Original column.
                    $value = Kwf_SourceMaps_Base64VLQ::decodePos($str, $pos);
                    $mapping['originalColumn'] = $previousOriginalColumn + $value;
                    $previousOriginalColumn = $mapping['originalColumn'];

                    if ($pos < $end && !($str[$pos] == ',' || $str[$pos] == ';')) {
                        // Original name.
                        $value = Kwf_SourceMaps_Base64VLQ::decodePos($str, $pos);
                        $mapping['originalName'] = $this->_map->names[$previousName + $value];
                        $previousName += $value;
                    } else {
                        $mapping['originalName'] = null;
                    }
                }
                $this->_mappings[] = $mapping;
            }
        }
        return $this->_mappings;
    }
419865
public function getAvailablePosition(View $view)
    {
        $widgetMaps = $view->getBuiltWidgetMap();

        $availablePositions = [];
        foreach ($widgetMaps as $slot => $widgetMap) {
            foreach ($widgetMap as $_widgetMap) {
                $availablePositions[$slot][$_widgetMap->getId()]['id'] = $_widgetMap->getId();
                $availablePositions[$slot][$_widgetMap->getId()][WidgetMap::POSITION_BEFORE] = true;
                $availablePositions[$slot][$_widgetMap->getId()][WidgetMap::POSITION_AFTER] = true;
                if ($_widgetMap->getReplaced()) {
                    $availablePositions[$slot][$_widgetMap->getId()]['replaced'] = $_widgetMap->getReplaced()->getId();
                }
            }
            /** @var WidgetMap $_widgetMap */
            foreach ($widgetMap as $_widgetMap) {
                if ($_widgetMap->getParent()) {
                    if ($substitute = $_widgetMap->getParent()->getSubstituteForView($view)) {
                        $availablePositions[$slot][$substitute->getId()][$_widgetMap->getPosition()] = false;
                    } else {
                        $availablePositions[$slot][$_widgetMap->getParent()->getId()][$_widgetMap->getPosition()] = false;
                    }
                }
            }
        }

        return $availablePositions;
    }
463167
protected function getMapsOptions()
    {
        return [
            'dragndrop'     => Translate::t('map.options.dragndrop', [], 'mapfield'),
            'streetview'    => Translate::t('map.options.streetview', [], 'mapfield'),
            'zoomcontrol'   => Translate::t('map.options.zoomcontrol', [], 'mapfield'),

            'mapcontrol'    => Translate::t('map.options.mapcontrol', [], 'mapfield'),
            'scalecontrol'  => Translate::t('map.options.scalecontrol', [], 'mapfield'),
            'pancontrol'    => Translate::t('map.options.pancontrol', [], 'mapfield'),

            'rotatecontrol'         => Translate::t('map.options.rotatecontrol', [], 'mapfield'),
            'rotatecontroloptions'  => Translate::t('map.options.rotatecontroloptions', [], 'mapfield'),
            'scrollwheel'           => Translate::t('map.options.scrollwheel', [], 'mapfield'),

            'overviewmapcontrol'        => Translate::t('map.options.overviewmapcontrol', [], 'mapfield'),
            'overviewmapcontroloptions' => Translate::t('map.options.overviewmapcontroloptions', [], 'mapfield'),
        ];
    }
32359
protected function getAll()
    {
        $widgets = getConfig('Widgets.general', []);

        if ($this->getView()->getRequest()->isUrl(['_name' => 'homepage']) && getConfig('Widgets.homepage')) {
            $widgets = getConfig('Widgets.homepage');
        }

        return $widgets ? collection($widgets)->map(function ($args, $name) {
            if (is_string($name) && is_array($args)) {
                return [$name => $args];
            } elseif (is_string($args)) {
                return [$args => []];
            }

            list($name, $args) = [array_key_first($args), array_value_first($args)];

            return is_int($name) && is_string($args) ? [$args => []] : [$name => $args];
        })->toList() : [];
    }
1169996
public function getAllForView(View $view)
    {
        //Get all WidgetMaps ids for this View
        $widgetMapsIdsToSearch = [];
        foreach ($view->getBuiltWidgetMap() as $widgetMaps) {
            foreach ($widgetMaps as $widgetMap) {
                $widgetMapsIdsToSearch[] = $widgetMap->getId();
            }
        }

        return $this->createQueryBuilder('widget')
            ->join('widget.widgetMap', 'widgetMap')
            ->andWhere('widgetMap.id IN (:widgetMapsIds)')
            ->setParameter('widgetMapsIds', $widgetMapsIdsToSearch);
    }
943632
public function getActiveViewPlugins()
    {
        $ret = $this->_getSetting('plugins');
        $d = $this->getData();
        if ($d->isPage) {
            while ($d) {
                foreach (Kwc_Abstract::getSetting($d->componentClass, 'pluginsInherit') as $i) {
                    if (!in_array($i, $ret)) $ret[] = $i;
                }
                $d = $d->parent;
            }
        }
        return $ret;
    }
938360
public function getLayoutPlaceHolderNames()
	{
		$layout = $this->getLayout();

		if ($layout === null) {
			return null;
		}

		return $this->getLayoutProcessor()
				->getPlaces($layout->getFileName());
	}
41870
protected function removeOverwritedWidgetMaps($widgetMaps)
    {
        $slots = [];
        /** @var WidgetMap $widgetMapItem */
        foreach ($widgetMaps as $widgetMapItem) {
            $id = $widgetMapItem->getId();
            // If the widgetmap replace one (has a "replaced"), use the replaced id as key
            if ($widgetMapItem->getReplaced()) {
                $id = $widgetMapItem->getReplaced()->getId();
            }
            // If "id" is not present in slot array or
            if (empty($slots[$widgetMapItem->getSlot()][$id])
                // or if the id exists AND the inserted widgetmap is overwrite|delete, then erase the initial widget by it
                || !empty($slots[$widgetMapItem->getSlot()][$id])
                && $widgetMapItem->getAction() !== WidgetMap::ACTION_CREATE) {
                $slots[$widgetMapItem->getSlot()][$id] = $widgetMapItem;
            }
        }

        return $slots;
    }
707738
def get_widgets(self):
        
        widgets = OrderedDict()
        mappings = {}
        for dim in self.mock_obj.kdims:
            holomap = None if self.plot.dynamic else self.mock_obj
            widget, label, mapping = self.create_widget(dim, holomap, self.editable)
            if label is not None and not isinstance(label, Div):
                label.on_change('value', partial(self.on_change, dim, 'label'))
            widget.on_change('value', partial(self.on_change, dim, 'widget'))
            widgets[dim.pprint_label] = (label, widget)
            if mapping:
                mappings[dim.pprint_label] = OrderedDict(mapping)
        return widgets, mappings
1156837
public function getMapTables()
    {
        $tables = [];

        if (is_array($GLOBALS['con4gis']['maps']['sourcetable']))
        {
            foreach ($GLOBALS['con4gis']['maps']['sourcetable'] as $key=>$sourcetable) {
                $tables[$key] = $GLOBALS['TL_LANG']['c4g_maps']['sourcetable'][$key]['name'];
            }
        }

        return $tables;
    }