Back to PluginAdapter class

Method getElement

public string
getElement
(mixed $element = null)
Get the filtered extension element from the manifest
Parameters
  • string $element Optional element name to be converted
Returns
  • string The filtered element
Since
  • 3.4
Class: PluginAdapter
Project: Joomla

Method getElement - Source code

/**
 * Get the filtered extension element from the manifest
 *
 * @param   string  $element  Optional element name to be converted
 *
 * @return  string  The filtered element
 *
 * @since   3.4
 */
public function getElement($element = null)
{
    if ($element || !$this->getManifest()) {
        return $element;
    }
    // Backward Compatibility
    // @todo Deprecate in future version
    if (!\count($this->getManifest()->files->children())) {
        return $element;
    }
    $type = (string) $this->getManifest()->attributes()->type;
    foreach ($this->getManifest()->files->children() as $file) {
        if ((string) $file->attributes()->{$type}) {
            $element = (string) $file->attributes()->{$type};
            break;
        }
    }
    return $element;
}