Get the list of all block regions known to this theme in all templates.

@return array internal region name => human readable name.
779025
public function get_all_block_regions() {
        $regions = array();
        foreach ($this->layouts as $layoutinfo) {
            foreach ($layoutinfo['regions'] as $region) {
                $regions[$region] = $this->get_region_name($region, $this->name);
            }
        }
        return $regions;
    }
732844
public function getCustomStyleSetID()
    {
        $db = Loader::db();
        if (!isset($this->issID)) {
            $co = $this->getBlockCollectionObject();

            $arHandle = $this->getAreaHandle();
            if ($arHandle) {
                $a = $this->getBlockAreaObject();
                if ($a->isGlobalArea()) {
                    // then we need to check against the global area name. We currently have the wrong area handle passed in
                    $arHandle = STACKS_AREA_NAME;
                }

                $v = [
                    $co->getCollectionID(),
                    $co->getVersionID(),
                    $arHandle,
                    $this->getBlockID(),
                ];

                $this->issID = (int) $db->GetOne(
                    'select issID from CollectionVersionBlockStyles where cID = ? and cvID = ? and arHandle = ? and bID = ?',
                    $v
                );
            } else {
                $this->issID = 0;
            }
        }

        return $this->issID;
    }
486869
public function parseLines()
    {
        $text = [];

        while (($line = $this->nextLine()) !== false) {
            $line = rtrim($line);

            // Skip empty lines
            if ($line == "") {
                $text[] = null;
                continue;
            }

            // Look at start of line to detect valid blocktypes
            $blockTypes = [];
            $marker = $line[0];
            if (isset($this->blockTypes[$marker])) {
                foreach ($this->blockTypes[$marker] as $blockType) {
                    $blockTypes[] = $blockType;
                }
            }

            // Check if line is matching a detected blocktype
            foreach ($blockTypes as $blockType) {
                if ($this->{"block".$blockType}($line)) {
                    continue;
                }
            }
        }

        $text = implode("\n", $this->lines);

        return [
            "text" => $text,
            "frontmatter" => $this->frontmatter,
        ];
    }
767170
protected function getPageTemplates()
    {
        $choices = [];

        $templates = $this->getContainer()->getParameter('networking_init_cms.page.templates');
        foreach ($templates as $key => $template) {
            $choices[$template['name']] = $key;
        }

        return $choices;
    }
673301
private function getLocalizedAreas()
    {
        $areas = $this->getParameter('sulu_snippet.areas');
        $locale = $this->getUser()->getLocale();

        $localizedAreas = [];

        foreach ($areas as $type) {
            $title = ucfirst($type['key']);

            if (isset($type['title'][$locale])) {
                $title = $type['title'][$locale];
            }

            $localizedAreas[$type['key']] = [
                'title' => $title,
                'template' => $type['template'],
            ];
        }

        return $localizedAreas;
    }
1139392
public function getRegions($themeName)
    {
        $translator = $this->getTranslator();
        $options = $this->getModuleOptions();
        $theme = $options->getThemeByName($themeName);
        $map = [];

        if (! isset($theme['frontend']['regions'])
            || ! is_array($theme['frontend']['regions'])
            || empty($theme['frontend']['regions'])
        ) {
            return $map;
        }
        $regions = $theme['frontend']['regions'];
        $widgets = array_keys($options->getWidgets());

        foreach ($regions as $regionName => $regionOptions) {
            if (isset($regionOptions['contains'])
                && is_array($regionOptions['contains'])
            ) {
                $container = $regionOptions['contains'];
                foreach ($container as $widget) {
                    $map[$widget] = $regionName;
                }
            }
        }
        foreach ($widgets as $widget) {
            if (! array_key_exists($widget, $map)) {
                $map[$widget] = 'none';
            }
        }
        return $map;
    }
455293
protected function get_region_name($region, $theme) {
        $regionstring = get_string('region-' . $region, 'theme_' . $theme);
        // A name exists in this theme, so use it
        if (substr($regionstring, 0, 1) != '[') {
            return $regionstring;
        }

        // Otherwise, try to find one elsewhere
        // Check parents, if any
        foreach ($this->parents as $parentthemename) {
            $regionstring = get_string('region-' . $region, 'theme_' . $parentthemename);
            if (substr($regionstring, 0, 1) != '[') {
                return $regionstring;
            }
        }

        // Last resort, try the boost theme for names
        return get_string('region-' . $region, 'theme_boost');
    }
262414
public function getBlockListInfo()
    {
        $blockList = [];
        foreach ($this->getBlockNames() as $blockName) {
            $importBlock = $this->getAggregatedBlock($blockName);
            $currentBlock = $this->getBlock($importBlock->blockData['name'], 'db');
            $blockList[$blockName] = [
                'block_name' => $blockName,
                'display_class' => 'none',
                'update_templates' => -1
            ];
            if ($importBlock->inCategoryTemplates || $importBlock->specifiedPageIds) {
                $blockList[$blockName]['display_class'] = 'info';
            }
            if ($this->hasChanges($importBlock, 'blockData')) {
                $blockList[$blockName]['display_class'] = 'update';
            }
            foreach (['templates', 'repeaterChildBlocks'] as $property) {
                if ($importBlock->$property) {
                    $blockList[$blockName]['update_templates'] = 0;
                }
                if ($this->hasChanges($importBlock, $property)) {
                    $blockList[$blockName]['display_class'] = 'update';
                    $blockList[$blockName]['update_templates'] = 1;
                    break;
                }
            }
            if (!($importBlock->templates || $importBlock->inRepeaterBlocks || $importBlock->inCategoryTemplates || $importBlock->specifiedPageIds)) {
                $blockList[$blockName]['display_class'] = 'delete';
            } elseif (!($currentBlock->templates || $currentBlock->inRepeaterBlocks || $currentBlock->inCategoryTemplates || $currentBlock->specifiedPageIds)) {
                $blockList[$blockName]['display_class'] = ($blockList[$blockName]['display_class'] == 'info') ? 'info' : 'new';
            } elseif ($this->hasChanges($importBlock, 'globalData')) {
                $blockList[$blockName]['display_class'] = 'update';
                $blockList[$blockName]['update_templates'] = 1;
            }
        }
        uasort($blockList, [$this, '_orderBlockChanges']);
        return $blockList;
    }
906452
public function getTemplatesArray()
    {
        $templates = $this->getTemplates();

        foreach ($templates as $template) {
            $templates_array[$template->name] = $this->crud->makeLabel($template->name);
        }

        return $templates_array;
    }
414961
private function getSections() {
		$sections = array();
		foreach (Craft::$app->getSections()->getEditableSections() as $section) {
			$sections[$section->id] = Craft::t('site', $section->name);
		}
		return $sections;
	}
806353
public function getTemplateInheritors()
    {
        $templateInheritors = [];
        foreach ($this->inheritors as $inheritor) {
            if ($inheritor instanceof self) {
                $templateInheritors[] = $inheritor;
            }
        }

        return $templateInheritors;
    }
50871
public function toArray()
    {
        $result = array();
        foreach ($this->blockManagers as $blockManager) {
            if (null !== $blockManager) {
                $result[] = $blockManager->toArray();
            }
        }

        return $result;
    }
158224
public function listTemplateNames()
    {
        $this->setUpTemplate();
        $ret = array();
        foreach ($this->templates as $key => $val) {
            $ret[] = $key;
        }
        return $ret;
    }
1372469
public function getThirdPartyBlocks()
    {
        /** @var Application $application */
        $application = $this->get('application');
        $embeddedComposer = $application->getEmbeddedComposer();
        $config = $embeddedComposer->getExternalComposerConfig();
        $loadBlock = $config->has('block-loader') ? $config->get('block-loader') : '.bldr/blocks.yml';
        $blockFile = $embeddedComposer->getExternalRootDirectory().DIRECTORY_SEPARATOR.$loadBlock;

        if (!file_exists($blockFile)) {
            return [];
        }

        $blockNames = Yaml::parse(file_get_contents($blockFile));
        if (null === $blockNames) {
            return [];
        }

        $blocks     = [];
        foreach ($blockNames as $block) {
            $blocks[] = new $block();
        }

        return $blocks;
    }
830950
public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->addFieldToTab(
            'Root.Blocks',
            GridField::create(
                'Blocks',
                'Blocks',
                $this->Blocks(),
                GridFieldConfig_MultiClassRecord::create(
                    $this->Blocks(),
                    singleton('BlockObject_Preset')->SubClassNames
                )
            )
        );
        $this->extend('updateCMSFields', $fields);
        return $fields;
    }
1079814
public function getWroteBlocks()
    {
        if (!is_dir($this->blocks)) {
            throw new RuntimeException("cannot obtain the blocks ({$this->blocks})");
        }
        $files = array_filter(array_map(function($file) {
            $basename = basename($file);
            if (!is_numeric($basename)) {
                return false;
            }
            return [
                'offset' => (int)$basename,
                'file' => $file,
                'size' => filesize($file)
            ];
        }, glob($this->blocks . "*")));

        uasort($files, function($a, $b) {
            return $a['offset'] - $b['offset'];
        });

        return $files;
    }
897613
public function getPageMainZones()
    {
        $result = array();

        if (null === $this->getLayout()) {
            return $result;
        }

        $currentpageRootZones = $this->getContentSet();
        $layoutZones = $this->getLayout()->getZones();
        $count = count($layoutZones);
        for ($i = 0; $i < $count; $i++) {
            $zoneInfos = $layoutZones[$i];
            $currentZone = $currentpageRootZones->item($i);

            if (
                null !== $currentZone
                && null !== $zoneInfos
                && true === property_exists($zoneInfos, 'mainZone')
                && true === $zoneInfos->mainZone
            ) {
                $result[$currentZone->getUid()] = $currentZone;
            }
        }

        return $result;
    }