Get the parameters for a plugin
Merges default params and custom params (take precedence)

@param   integer  $oid      Object ID (eg, group ID)
@param   string   $folder   Plugin folder
@param   string   $element  Plugin name
@return  object
978394
public static function getParams($oid=null, $folder=null, $element=null)
	{
		$custom = self::getCustomParams($oid, $folder, $element);

		$params = self::getDefaultParams($folder, $element);
		$params->merge($custom);

		return $params;
	}
146187
private function elementToRdf(JsonObject $element)
    {
        if (property_exists($element, '@value')) {
            return Value::fromJsonLd($element);
        }

        $iri = new IRI($element->{'@id'});

        return $iri->isAbsolute() ? $iri : null;
    }
1010708
protected function getNode(ObjectId $oid) {
    $oidStr = $oid->__toString();
    if (!isset($this->deserializedNodes[$oidStr])) {
      $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
      $type = $oid->getType();
      if ($persistenceFacade->isKnownType($type)) {
        // don't create all values by default (-> don't use PersistenceFacade::create() directly, just for determining the class)
        $class = get_class($persistenceFacade->create($type, BuildDepth::SINGLE));
        $node = new $class;
      }
      else {
        $node = new Node($type);
      }
      $node->setOID($oid);
      $this->deserializedNodes[$oidStr] = $node;
    }
    return $this->deserializedNodes[$oidStr];
  }
165049
public static function getParams($name, $folder)
	{
		$database = \App::get('db');

		// load the params from databse
		$sql = "SELECT params FROM `#__extensions` WHERE folder=" . $database->quote($folder) . " AND element=" . $database->quote($name) . " AND enabled=1";
		$database->setQuery($sql);
		$result = $database->loadResult();

		// params object
		$params = new Registry($result);
		return $params;
	}
552424
public function findByElementAndNotUserId(Element $element, $notUserId)
    {
        $qb = $this->createQueryBuilder('l');
        $qb
            ->where($qb->expr()->eq('l.element', $element->getEid()))
            ->andWhere($qb->expr()->neq('l.userId', $qb->expr()->literal($notUserId)));

        return $qb->getQuery()->getResult();
    }
1153437
public function getExtension($element, $type = 'component', $group = null)
    {
        $db = JFactory::getDbo();
        $sql = "SELECT `extension_id` AS `id`, `state` FROM `#__extensions`"
                ." WHERE `element` = ".$db->quote($element)." AND `type` = ".$db->quote($type);

        if ($type == 'plugin' && !empty($group)) {
            $sql .= ' AND `folder` =' . $db->quote($group);
        }

        $extension = $db->setQuery($sql)->loadObject();

        if ($extension && $extension->state != -1); {
            return $extension;
        }

        return false;
    }
1294314
protected function validateArguments($element)
    {
        $params = $element->getDocBlock()->getTagsByName('param');
        $arguments = $element->getArguments();

        foreach (array_values($arguments) as $key => $argument) {
            if (!$this->isArgumentInDocBlock($key, $argument, $element, $params)) {
                continue;
            }

            $result = $this->doesArgumentNameMatchParam($params[$key], $argument, $element);
            if ($result) {
                return $result;
            }

            $result = $this->doesArgumentTypehintMatchParam($params[$key], $argument, $element);
            if ($result) {
                return $result;
            }
        }

        /** @var ParamTag $param */
        foreach ($params as $param) {
            $param_name = $param->getVariableName();

            if (isset($arguments[$param_name])) {
                continue;
            }

            return new Error(
                LogLevel::NOTICE,
                'PPC:ERR-50013',
                $element->getLinenumber(),
                array($param_name, $element->getName())
            );
        }

        return null;
    }
944991
protected function get_plugin_element($final_elements = null, $conditionparam = null, $conditionvalue = null) {
        // Something exclusive for this backup_plugin_element (backup_optigroup_element)
        // because it hasn't XML representation
        $name = 'optigroup_' . $this->plugintype . '_' . $this->pluginname . '_' . $this->connectionpoint;
        $optigroup_element = new backup_plugin_element($name, $final_elements, $conditionparam, $conditionvalue);
        $this->optigroup->add_child($optigroup_element);  // Add optigroup_element to stay connected since beginning
        return $optigroup_element;
    }
644035
protected function getFormElements($type = 'list', $element)
    {
        $form = array();
        $template = $this->getTemplate("{$type}-block");
        $attributes = $this->getModelAttributes($this->tableInfo);

        foreach($attributes as $name)
        {
            $form[] = $this->renderElement($template, $element, $name);
        }

        return implode(PHP_EOL . PHP_EOL, $form);
    }
966161
public function getById($id)
    {
        if (isset($this->elements[$id])) {
            return $this->elements[$id];
        }

        throw new \InvalidArgumentException(sprintf('Element for id %s does not exist', $id));
    }
557115
private function collectJoinTableColumnParameters(PersistentCollection $collection, $element)
    {
        $params           = [];
        $association      = $collection->getMapping();
        $owningClass      = $this->em->getClassMetadata(get_class($collection->getOwner()));
        $targetClass      = $collection->getTypeClass();
        $owningIdentifier = $this->uow->getEntityIdentifier($collection->getOwner());
        $targetIdentifier = $this->uow->getEntityIdentifier($element);
        $joinTable        = $association->getJoinTable();

        foreach ($joinTable->getJoinColumns() as $joinColumn) {
            $fieldName = $owningClass->fieldNames[$joinColumn->getReferencedColumnName()];

            $params[] = $owningIdentifier[$fieldName];
        }

        foreach ($joinTable->getInverseJoinColumns() as $joinColumn) {
            $fieldName = $targetClass->fieldNames[$joinColumn->getReferencedColumnName()];

            $params[] = $targetIdentifier[$fieldName];
        }

        return $params;
    }
617869
public function parseElements(array $elements, ElementInterface $parent = null)
    {
        foreach ($elements as $element) {
            try {
                $object = $this->elementFactory->make($element['name']);
            } catch (InvalidElementException $e) {
                $object = $this->getReservation($element['name']);
            }

            // Set some stuff
            $object->setCollection($this->collection);
            $object->setAttributes($element['attributes']);

            if ( ! is_array($element['value'])) {
                $object->setValue(trim($element['value']));
            }

            // Add the object to the collection
            $this->collection->add($object);

            if ($parent) {
                $object->setParent($parent);
                $parent->addChild($object);
            }

            if (is_array($element['value'])) {
                $this->parseElements($element['value'], $object);
            }

            // Initialize object
            $object->init();

            if ($object instanceof ReservationInterface) {
                $object = $object->getElement($this, $parent);
            }

            $data[] = $object;
        }

        return $data;
    }
1273171
public function getParameterByID($id)
    {
        $param = current(array_filter($this->params, function (Param $param) use ($id) {
            return ($param->id === $id);
        }));

        return ($param) ? $param : null;
    }
821681
protected function getNodeTemplate($oid) {
    // load object if existing to get the original data
    $originalNode = $this->persistenceFacade->load($oid, BuildDepth::SINGLE);

    // create the request node and copy the orignal data
    $class = get_class($this->persistenceFacade->create($oid->getType(), BuildDepth::SINGLE));
    $node = new $class;
    if ($originalNode) {
      $originalNode->copyValues($node);
    }
    return $node;
  }
840768
protected function processElements(Plugin $plugin, &$log = '', $xml = false)
    {

        if (!$xml)
            $xml = $this->loadXML($plugin->Path);

        if(!$xml)
            throw new Exception('Missing plugin.xml file for plugin ['.$plugin->Slug.']');

        $processedSlugs = array();

        // add elements
        $elements = $xml->elements;
        if (!empty($elements)) {
            foreach ( $elements->element as $elementNode ) {

                $element = new Element();
                $this->ModelMapper->defaultsOnModel($element);

                $this->SystemXMLConverter->xmlToElement($element, $elementNode);

                $log .= "Processing element descriptor: {$element->Slug}\n";

                if ($this->ElementService->slugExists($element->Slug)) {
                    $existingElement = $this->ElementService->getBySlug($element->Slug);

                    if ($existingElement->PluginID != $plugin->PluginID)
                    {
                        $log .= 'WARNING: Element already exists for slug: '.$existingElement->Slug."\n";
                        continue;
                    }

                    $element->ElementID = $existingElement->ElementID;
                }

                $element->PluginID = $plugin->PluginID;
                $anchorSite = $this->SiteService->getAnchoredSite();
                if(empty($anchorSite))
                    throw new Exception('Cannot install element without anchor site');
                $element->AnchoredSiteSlug = $anchorSite->getSlug();
                $element->AnchoredSiteSlugOverride = $anchorSite->getSlug();
                $element->AnchoredSite = $anchorSite;

                if ($this->ElementService->slugExists($element->Slug)) {
                    $log .= "Element updated...\n";
                    $this->ElementService->edit($element);
                } else {
                    $log .= "Element created...\n";
                    $this->ElementService->add($element);
                }

                $log .= "ID: {$element->ElementID}\n";
                $log .= "Slug: {$element->Slug}\n";
                $log .= "Name: {$element->Name}\n";
                $log .= "Description: {$element->Description}\n";
                $log .= "\n";

                $log .= "Creating element DB schema...";
                $element = $this->ElementService->getBySlug($element->Slug); //refresh schema
                $this->NodeService->createDBSchema($element);
                $log .= "done.\n\n";
            }
        }
    }
864256
public function transform($folder, array $params = array())
    {
        if (!$folder instanceof FolderInterface) {
            throw new TransformerParameterTypeException();
        }
        $facade = $this->newFacade();
        $facade->folderId = $folder->getId();
        $facade->name = $this->multiLanguageChoiceManager->choose($folder->getNames());
        $facade->createdAt = $folder->getCreatedAt();
        $facade->updatedAt = $folder->getUpdatedAt();
        if ($folder->getParent() instanceof FolderInterface) {
            $facade->parentId = $folder->getParent()->getId();
        } else {
            $facade->parentId = FolderInterface::ROOT_PARENT_ID;
        }
        $facade->siteId = $folder->getSiteId();

        return $facade;
    }
8594
public function li($element, array $options = [])
    {
        if (!is_array($element)) {
            return self::tag('li', $element, $options);
        }

        $element = array_map(function ($element) use ($options) {
            return self::tag('li', $element, $options);
        }, $element);

        return implode(PHP_EOL, $element);
    }