Returns a list of site configurations, filtering by section.

@param  string $section section name
@return stdClass object containing the settings
556598
public static function get_config($section) {
        global $CFG, $SITE;

        $settings = new \stdClass;
        $context = context_system::instance();
        $isadmin = has_capability('moodle/site:config', $context);

        if (empty($section) or $section == 'frontpagesettings') {
            require_once($CFG->dirroot . '/course/format/lib.php');
            // First settings that anyone can deduce.
            $settings->fullname = external_format_string($SITE->fullname, $context->id);
            $settings->shortname = external_format_string($SITE->shortname, $context->id);

            // Return to a var instead of directly to $settings object because of differences between
            // list() in php5 and php7. {@link http://php.net/manual/en/function.list.php}
            $formattedsummary = external_format_text($SITE->summary, $SITE->summaryformat,
                                                                                        $context->id);
            $settings->summary = $formattedsummary[0];
            $settings->summaryformat = $formattedsummary[1];
            $settings->frontpage = $CFG->frontpage;
            $settings->frontpageloggedin = $CFG->frontpageloggedin;
            $settings->maxcategorydepth = $CFG->maxcategorydepth;
            $settings->frontpagecourselimit = $CFG->frontpagecourselimit;
            $settings->numsections = course_get_format($SITE)->get_last_section_number();
            $settings->newsitems = $SITE->newsitems;
            $settings->commentsperpage = $CFG->commentsperpage;

            // Now, admin settings.
            if ($isadmin) {
                $settings->defaultfrontpageroleid = $CFG->defaultfrontpageroleid;
            }
        }

        if (empty($section) or $section == 'sitepolicies') {
            $manager = new \core_privacy\local\sitepolicy\manager();
            $settings->sitepolicy = ($sitepolicy = $manager->get_embed_url()) ? $sitepolicy->out(false) : '';
            $settings->sitepolicyhandler = $CFG->sitepolicyhandler;
            $settings->disableuserimages = $CFG->disableuserimages;
        }

        if (empty($section) or $section == 'gradessettings') {
            require_once($CFG->dirroot . '/user/lib.php');
            $settings->mygradesurl = user_mygrades_url();
            // The previous function may return moodle_url instances or plain string URLs.
            if ($settings->mygradesurl instanceof moodle_url) {
                $settings->mygradesurl = $settings->mygradesurl->out(false);
            }
        }

        if (empty($section) or $section == 'mobileapp') {
            $settings->tool_mobile_forcelogout = get_config('tool_mobile', 'forcelogout');
            $settings->tool_mobile_customlangstrings = get_config('tool_mobile', 'customlangstrings');
            $settings->tool_mobile_disabledfeatures = get_config('tool_mobile', 'disabledfeatures');
            $settings->tool_mobile_custommenuitems = get_config('tool_mobile', 'custommenuitems');
            $settings->tool_mobile_apppolicy = get_config('tool_mobile', 'apppolicy');
        }

        if (empty($section) or $section == 'calendar') {
            $settings->calendartype = $CFG->calendartype;
            $settings->calendar_site_timeformat = $CFG->calendar_site_timeformat;
            $settings->calendar_startwday = $CFG->calendar_startwday;
            $settings->calendar_adminseesall = $CFG->calendar_adminseesall;
            $settings->calendar_lookahead = $CFG->calendar_lookahead;
            $settings->calendar_maxevents = $CFG->calendar_maxevents;
        }

        return $settings;
    }
440995
public function getCategories($domainName, $sectionName): Finder
    {
        if (!in_array($sectionName, $this->getSectionNames($domainName))) {
            throw new \Exception('Section not found for given domain');
        }

        return (new Finder())
            ->directories()
            ->in(__DIR__.DIRECTORY_SEPARATOR.$domainName.DIRECTORY_SEPARATOR.$sectionName)
            ->depth(0)
        ;
    }
34463
public function delete_all($section)
	{
		// determine the section index name
		$section = $this->config['cache_id'].(empty($section)?'':'.'.$section);

		// get the directory index
		$index = xcache_get($this->config['cache_id'].'__DIR__');

		if (is_array($index))
		{
			// limit the delete if we have a valid section
			if ( ! empty($section))
			{
				$dirs = in_array($section, $index) ? array($section) : array();
			}
			else
			{
				$dirs = $index;
			}

			// loop through the indexes, delete all stored keys, then delete the indexes
			foreach ($dirs as $dir)
			{
				$list = xcache_get($dir);
				foreach ($list as $item)
				{
					xcache_unset($item[0]);
				}
				xcache_unset($dir);
			}

			// update the directory index
			$index = array_diff($index, $dirs);
			xcache_set($this->config['cache_id'].'__DIR__', $index);
		}
	}
1045648
private function getEntityProperties(SectionInterface $section): array
    {
        $sectionFullyQualifiedClassName = (string) $section->getConfig()->getFullyQualifiedClassName();
        $sectionEntity = new $sectionFullyQualifiedClassName;

        return $sectionEntity::FIELDS;
    }
414961
private function getSections() {
		$sections = array();
		foreach (Craft::$app->getSections()->getEditableSections() as $section) {
			$sections[$section->id] = Craft::t('site', $section->name);
		}
		return $sections;
	}
1224182
public static function getBySectionOfSite($page)
    {
        $identifier = sprintf('/multilingual/section/%s', $page->getCollectionID());
        $cache = \Core::make('cache/request');
        $item = $cache->getItem($identifier);
        if (!$item->isMiss()) {
            $returnID = $item->get();
        } else {

            $item->lock();

            $returnID = false;

            if ($page->isPageDraft()) {
                $tree = false;
                if ($page->getPageDraftTargetParentPageID()) {
                    $cParentID = $page->getPageDraftTargetParentPageID();
                    if ($cParentID) {
                        $parent = Page::getByID($cParentID);
                        $tree = $parent->getSiteTreeObject();
                    }
                }
            }

            if (!isset($tree)) {
                $tree = $page->getSiteTreeObject();
            }

            if ($tree instanceof SiteTree) {
                $returnID = $tree->getSiteHomePageID();
            }

            $cache->save($item->set($returnID));
        }

        if ($returnID) {
            return static::getByID($returnID);
        }
    }
257086
public static function getCategoryFromMultilingualSection(Section $section)
    {
        $sc = null;
        if ($section->isDefaultMultilingualSection()) {
            return static::getFromDefaultMultilingualSection();
        } else {
            // we find the stack category located at /paths/locale
            $text = Core::make('helper/text');
            $locale = $section->getLocale();
            $path = STACKS_PAGE_PATH . '/' . $locale;
            $page = \Page::getByPath($path);
            if (is_object($page) && !$page->isError()) {
                $sc = new self($page);
            }
        }

        return $sc;
    }
330580
public function createSection($settings = null) {
		$sectionCount = $this->_countSections() + 1;
		
		$section = new PHPWord_Section($sectionCount, $settings);
		$this->_sectionCollection[] = $section;
		return $section;
	}
178436
public function getWidgetsData(Section $section): array
    {
        switch ($this->config->widgetsStorageType) {
            
            case $this->config::STORAGE_TYPE_DB:
                $storage = new WidgetsDbStorage($this->db);
                break;
                
            case $this->config::STORAGE_TYPE_ARRAY:
                if (!empty($this->config->widgetsStoragePath) 
                && file_exists($this->config->projectPath . $this->config->widgetsStoragePath)) {
                    $storageData = require $this->config->projectPath . $this->config->widgetsStoragePath;
                } else {
                    $storageData = $this->config->widgetsStorageData;
                }
                $storage = new WidgetsArrayStorage($storageData);
                break;
                
            default:
                return [];
                
        }
        
        return $storage->getWidgets($section);
    }
788614
public function getConfigurationSection($package)
	{
		if (!isset($this->configurationSections[$package])) {
			throw new \Exception(sprintf('There is no configuration section for package "%s"', $package));
		}

		return $this->configurationSections[$package]['data'];
	}
24207
public function getCustomPaths( $section )
	{
		$paths = array();

		foreach ( $this->_manifests as $path => $manifest )
		{
			if ( isset( $manifest['custom'][$section] ) ) {
				$paths[$path] = $manifest['custom'][$section];
			}
		}

		return $paths;
	}
353454
protected function getSectionConfig(Config $config, $section)
    {
        $string = '';
        if (isset($config[$section])) {
            /** @var Config $config */
            $config = $config[$section];
            // If there is at least one section
            if ($config->count() > 0) {
                /** @var Config $values */
                foreach ($config as $name => $values) {
                    if ($values->count() > 0) {
                        $string .= $this->sections[$section] . ' ' . $name . PHP_EOL . '{' . PHP_EOL . "\t";
                        $string .= $this->getValuesString($values->toArray());
                        $string .= PHP_EOL . '}' . PHP_EOL;
                    }
                }
            }
        }
        return $string;
    }
63805
public function get_section($section) {
		if($this->isInitialized === true) {
			$retval = $this->fullConfig[$section];
		}
		else {
			throw new exception(__METHOD__ .": not initialized");
		}
		
		return($retval);
	}
664834
private function getSection()
    {
        $this->section = $this->modelFactory()->get($this->sectionClass());

        return $this->section;
    }
1258450
public function createFilteringDrawer($section)
    {
        $this->filteringForm = Widget::Form(null, 'get', 'filtering');
        $this->createFilteringDuplicator($section);

        return $this->filteringForm;
    }
995425
public function get_section_name($section) {
        $section = $this->get_section($section);
        if ((string)$section->name !== '') {
            // Return the name the user set.
            return format_string($section->name, true, array('context' => context_course::instance($this->courseid)));
        } else {
            return $this->get_default_section_name($section);
        }
    }
1252862
public function getSectionRouteRules(string $section, string $format = 'Craft', $siteId = null): array
    {
        $devMode = Craft::$app->getConfig()->getGeneral()->devMode;
        $cache = Craft::$app->getCache();

        // Set up our cache criteria
        $cacheKey = $this->getCacheKey($this::ROUTEMAP_SECTION_RULES, [$section, $format, $siteId]);
        $duration = $devMode ? $this::DEVMODE_ROUTEMAP_CACHE_DURATION : $this::ROUTEMAP_CACHE_DURATION;
        $dependency = new TagDependency([
            'tags' => [
                $this::ROUTEMAP_CACHE_TAG,
            ],
        ]);

        // Just return the data if it's already cached
        $routes = $cache->getOrSet($cacheKey, function () use ($section, $format, $siteId) {
            Craft::info(
                'Route Map cache miss: '.$section,
                __METHOD__
            );
            $resultingRoutes = [];

            $section = Craft::$app->getSections()->getSectionByHandle($section);
            if ($section) {
                $sites = $section->getSiteSettings();

                foreach ($sites as $site) {
                    if ($site->hasUrls && ($siteId === null || $site->siteId === $siteId)) {
                        // Get section data to return
                        $route = [
                            'handle'   => $section->handle,
                            'siteId'   => $site->siteId,
                            'type'     => $section->type,
                            'url'      => $site->uriFormat,
                            'template' => $site->template,
                        ];

                        // Normalize the routes based on the format
                        $resultingRoutes[$site->siteId] = $this->normalizeFormat($format, $route);
                    }
                }
            }
            // If there's only one siteId for this section, just return it
            if (\count($resultingRoutes) === 1) {
                $resultingRoutes = reset($resultingRoutes);
            }

            return $resultingRoutes;
        }, $duration, $dependency);

        return $routes;
    }