Dynamically add an array of setting items
@param string $owner
@param array  $definitions
9
public function addSettingItems($owner, array $definitions)
    {
        foreach ($definitions as $code => $definition) {
            $this->addSettingItem($owner, $code, $definition);
        }
    }
131371
private function setDefinitionConfigurator(Definition $definition, array $array)
    {
        if (isset($array['configurator'])) {
            $configurator = $array['configurator'];
            if (is_array($configurator)) {
                $configurator[0] = $this->convertArgument($configurator[0]);
            }

            $definition->setConfigurator($configurator);
        }
    }
288896
private function populateSettings(array $settings, ?string $owner = null): array
    {
        $objects = [];

        foreach ($settings as $setting) {
            $objects[] = $object = new Setting();
            $object->setOwner($owner);
            $object->setSection($setting->getSection()->getName());
            $object->setKey($setting->getKey());
            $object->setValue($setting->getValue());
        }

        return $objects;
    }
1237317
public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata)
    {
        // metadata
        $metadata .= $owner->MarkupComment('Metadata');
        // charset
        if ($config->CharsetEnabled()) {
            $metadata .= '<meta charset="' . $config->Charset() . '" />' . PHP_EOL;
        }
        // canonical
        if ($config->CanonicalEnabled()) {
            $metadata .= $owner->MarkupLink('canonical', $owner->AbsoluteLink());
        }
        // title
        if ($config->TitleEnabled()) {
            $metadata .= '<title>' . $owner->encodeContent($owner->GenerateTitle(), $config->Charset()) . '</title>' . PHP_EOL;
        }
        // description
        if ($description = $owner->GenerateDescription()) {
            $metadata .= $owner->MarkupMeta('description', $description, $config->Charset());
        }
        // extra metadata
        if ($config->ExtraMetaEnabled()) {
            $metadata .= $owner->MarkupComment('Extra Metadata');
            $metadata .= $owner->GenerateExtraMeta();
        }
    }
76479
private function menuBranch($owner = 0, $level = 0)
    {
        $result = array(array(), array());
        $items = Eresus_CMS::getLegacyKernel()->db->select('pages',
            "(`access` >= '" . USER . "') AND (`owner` = '" . $owner . "') AND (`active` = '1')",
            "-position", "`id`,`caption`");
        if (count($items))
        {
            foreach ($items as $item)
            {
                $result[0][] = str_repeat('- ', $level) . $item['caption'];
                $result[1][] = $item['id'];
                $sub = $this->menuBranch($item['id'], $level + 1);
                if (count($sub[0]))
                {
                    $result[0] = array_merge($result[0], $sub[0]);
                    $result[1] = array_merge($result[1], $sub[1]);
                }
            }
        }
        return $result;
    }
1201193
function setComponent (Component $owner)
  {
    $this->component = $owner;
    $props           = $this->getPropertiesOf (type::content);
    foreach ($props as $name => $value)
      if (!is_null ($value)) {
        /** @var Component $c */
        $c = clone $value;
        $c->attachTo ($owner);
        $this->$name = $c;
      }
    $props = $this->getPropertiesOf (type::collection);
    foreach ($props as $name => $values)
      if (!empty($values))
        $this->$name = Component::cloneComponents ($values, $owner);
  }
1045331
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null) if (m_fldMain != null) if (m_fldMain.getRecord() != owner)
            m_fldMain.addListener(new FieldRemoveBOnCloseHandler(this));
    }
191475
public function tocAction($owner, $ownerId)
    {
        /** @var BlockProviderInterface $provider */
        $provider = $this->get('opifer.content.block_provider_pool')->getProvider($owner);
        $object = $provider->getBlockOwner($ownerId);

        /** @var Environment $environment */
        $environment = $this->get('opifer.content.block_environment');
        $environment->setDraft(true)->setObject($object);
        $environment->setBlockMode('manage');

        $twigAnalyzer = $this->get('opifer.content.twig_analyzer');

        $parameters = [
            'environment' => $environment,
            'analyzer' => $twigAnalyzer,
            'object' => $environment->getObject(),
        ];

        return $this->render('OpiferContentBundle:Content:toc.html.twig', $parameters);
    }
1043648
public function setOwner(ContentInterface $owner = null)
    {
        if ($owner instanceof Content) {
            $this->content = $owner;
        } elseif ($owner instanceof Template) {
            $this->template = $owner;
        } elseif ($owner === null) {
            $this->template = null;
            $this->content = null;
        } else {
            throw new \Exception(sprintf('BlockInterface owner can only be of type Content or Template, not the provided %s type.', get_class($owner)));
        }

        return $this;
    }
635385
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null) if (m_recordToSync != null)
            m_recordToSync.addListener(new FileRemoveBOnCloseHandler(this));
    }
346075
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            if (m_converterSource == null)
                m_converterSource = this.getOwner();
            if (m_converterDest != null)
                if (m_converterDest.getField() != null)
                    if (m_converterSource.getField() == this.getOwner())    // Always!
                        if (((BaseField)m_converterDest.getField()).getRecord() != this.getOwner().getRecord())
            { // Not same file, if target file closes, remove this listener!
                ((BaseField)m_converterDest.getField()).getRecord().addListener(new FileRemoveBOnCloseHandler(this));
            }
        }
        else if (m_bFreeChainedConverters)
        {   // Free all the converters in the chain
            while ((m_converterDest != null) && (m_converterDest != m_converterDest.getField()))
            {
                Converter converterNext = null;
                if (m_converterDest instanceof FieldConverter)
                    converterNext = ((FieldConverter)m_converterDest).getNextConverter();
                m_converterDest.free();
                m_converterDest = converterNext;
            }
            while ((m_converterSource != null) && (m_converterSource != m_converterSource.getField()))
            {
                Converter converterNext = null;
                if (m_converterSource instanceof FieldConverter)
                    converterNext = ((FieldConverter)m_converterSource).getNextConverter();
                m_converterSource.free();
                m_converterSource = converterNext;
            }
        }
    }
999298
private function filter(Collection $settings, string $section, string $key, ?string $owner)
    {
        return $settings->filter(
            function (SettingInterface $setting) use ($section, $key, $owner) {
                return $section === $setting->getSection()
                    && $key === $setting->getKey()
                    && $owner === $setting->getOwner();
            }
        );
    }
881926
public function setCreatorOwner(string $creator_owner = "T") : CNabuDataObject
    {
        if ($creator_owner === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$creator_owner")
            );
        }
        $this->setValue('nb_user_group_type_creator_owner', $creator_owner);
        
        return $this;
    }
88161
public function setOwner($owner)
    {
        $this->owner = $owner instanceof SID ? $owner : new SID($owner);

        return $this;
    }
665453
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
            if (m_converter != null) if (m_converter.getField() != null)
                if (((BaseField)m_converter.getField()).getRecord() != owner)
                    {   // Points to different file... make sure this is removed if the other file is closed
                        ((BaseField)m_converter.getField()).addListener(new FieldRemoveBOnCloseHandler(this));
                    }
    }
826828
public function addSettingItem($owner, $code, array $definition)
    {
        $itemKey = $this->makeItemKey($owner, $code);

        if (isset($this->items[$itemKey])) {
            $definition = array_merge((array) $this->items[$itemKey], $definition);
        }

        $item = array_merge(self::$itemDefaults, array_merge($definition, [
            'code' => $code,
            'owner' => $owner
        ]));

        /*
         * Link to the generic settings page if a URL is not provided
         */
        if (isset($item['class']) && !isset($item['url'])) {
            $uri = [];

            if (strpos($owner, '.') !== null) {
                list($author, $plugin) = explode('.', $owner);
                $uri[] = strtolower($author);
                $uri[] = strtolower($plugin);
            }
            else {
                $uri[] = strtolower($owner);
            }

            $uri[] = strtolower($code);
            $uri =  implode('/', $uri);
            $item['url'] = Backend::url('system/settings/update/' . $uri);
        }

        $this->items[$itemKey] = (object) $item;
    }
368700
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            this.setupGridOrder();      // Set the initial grid order
            if (m_gridScreen != null)
            {
                m_gridScreen.setConverter(this.getOwner());   // The grid screen will automatically change this field to match the key order.
                this.getOwner().addComponent(m_gridScreen);
            }
        }
    }