protected function configToolMetadata(ConfigXML $config, $id)
    {
        $tool = $config->toArray('/config/tool')[0];

        $this->config(static::TOOL_ID, $id);
        $this->config(static::TOOL_NAME, (empty($tool['name']) ? $id : $tool['name']));
        $configPath = dirname($this->config(static::TOOL_CONFIG_FILE));

        $params = [
            'description' => static::TOOL_DESCRIPTION,
            'icon' => static::TOOL_ICON_URL,
            'domain' => static::TOOL_DOMAIN,
            'launch-privacy' => static::TOOL_LAUNCH_PRIVACY,
            'authenticate' => static::TOOL_LAUNCH_URL
        ];

        foreach ($params as $src => $dest) {
            if (empty($tool[$src])) {
                $this->clearConfig($dest);
            } else {
                if (substr($dest, -4) == '_URL') {
                    $this->config($dest, DataUtilities::URLfromPath(
                        $tool[$src],
                        $_SERVER,
                        $configPath)
                    );
                } else {
                    $this->config($dest, $tool[$src]);
                }
            }
        }

        if (empty($this->config(static::TOOL_LAUNCH_PRIVACY))) {
            $this->config(static::TOOL_LAUNCH_PRIVACY, static::DEFAULT_LAUNCH_PRIVACY);
        }

        if (empty($this->config(static::TOOL_LAUNCH_URL))) {
            $this->config(static::TOOL_LAUNCH_URL, DataUtilities::URLfromPath($_SERVER['SCRIPT_FILENAME']));
        }

        $this->log('Tool metadata configured');
    }
protected function configToolMetadata(ConfigXML $config, $id)
    {
        $tool = $config->toArray('/config/tool')[0];

        $this->config(static::TOOL_ID, $id);
        $this->config(static::TOOL_NAME, (empty($tool['name']) ? $id : $tool['name']));
        $configPath = dirname($this->config(static::TOOL_CONFIG_FILE));

        $params = [
            'description' => static::TOOL_DESCRIPTION,
            'icon' => static::TOOL_ICON_URL,
            'domain' => static::TOOL_DOMAIN,
            'launch-privacy' => static::TOOL_LAUNCH_PRIVACY,
            'authenticate' => static::TOOL_LAUNCH_URL
        ];

        foreach ($params as $src => $dest) {
            if (empty($tool[$src])) {
                $this->clearConfig($dest);
            } else {
                if (substr($dest, -4) == '_URL') {
                    $this->config($dest, DataUtilities::URLfromPath(
                        $tool[$src],
                        $_SERVER,
                        $configPath)
                    );
                } else {
                    $this->config($dest, $tool[$src]);
                }
            }
        }

        if (empty($this->config(static::TOOL_LAUNCH_PRIVACY))) {
            $this->config(static::TOOL_LAUNCH_PRIVACY, static::DEFAULT_LAUNCH_PRIVACY);
        }

        if (empty($this->config(static::TOOL_LAUNCH_URL))) {
            $this->config(static::TOOL_LAUNCH_URL, DataUtilities::URLfromPath($_SERVER['SCRIPT_FILENAME']));
        }

        $this->log('Tool metadata configured');
    }
protected function configToolMetadata ( ConfigXML $ config , $ id ) { $ tool = $ config -> toArray ( '/config/tool' ) [ 0 ] ; $ this -> config ( static :: TOOL_ID , $ id ) ; $ this -> config ( static :: TOOL_NAME , ( empty ( $ tool [ 'name' ] ) ? $ id : $ tool [ 'name' ] ) ) ; $ configPath = dirname ( $ this -> config ( static :: TOOL_CONFIG_FILE ) ) ; $ params = [ 'description' => static :: TOOL_DESCRIPTION , 'icon' => static :: TOOL_ICON_URL , 'domain' => static :: TOOL_DOMAIN , 'launch-privacy' => static :: TOOL_LAUNCH_PRIVACY , 'authenticate' => static :: TOOL_LAUNCH_URL ] ; foreach ( $ params as $ src => $ dest ) { if ( empty ( $ tool [ $ src ] ) ) { $ this -> clearConfig ( $ dest ) ; } else { if ( substr ( $ dest , - 4 ) == '_URL' ) { $ this -> config ( $ dest , DataUtilities :: URLfromPath ( $ tool [ $ src ] , $ _SERVER , $ configPath ) ) ; } else { $ this -> config ( $ dest , $ tool [ $ src ] ) ; } } } if ( empty ( $ this -> config ( static :: TOOL_LAUNCH_PRIVACY ) ) ) { $ this -> config ( static :: TOOL_LAUNCH_PRIVACY , static :: DEFAULT_LAUNCH_PRIVACY ) ; } if ( empty ( $ this -> config ( static :: TOOL_LAUNCH_URL ) ) ) { $ this -> config ( static :: TOOL_LAUNCH_URL , DataUtilities :: URLfromPath ( $ _SERVER [ 'SCRIPT_FILENAME' ] ) ) ; } $ this -> log ( 'Tool metadata configured' ) ; }
Configure the tool metadata from a configuration file
@param ConfigXML $config Configuration file object
@param string $id Unique, potentially auto-generated tool ID
@return void
Configure the tool metadata from a configuration file