'component', 'title' => 'Stock Component', 'description' => KernelTools::tra( "Display a link to a component in other content." ), 'help_page' => 'DataPluginComponent', 'auto_activate' => false, 'requires_pair' => false, 'syntax' => '{component id= }', 'plugin_type' => DATA_PLUGIN, 'booticon' => '{biticon ipackage="icons" iname="emblem-favorite" iexplain="Component"}', 'taginsert' => '{component id= nolink=}', 'help_function' => 'data_component_help', 'load_function' => 'data_component', ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATACOMPONENT, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATACOMPONENT ); function data_component( $pData, $pParams ) { global $gBitSystem; $ret = ' '; if( BitBase::verifyId( $pParams['id'] ) && $gBitSystem->isPackageActive( 'stock' ) ) { $item = new StockComponent( $pParams['id'], null ); if( $item->load() ) { $title = htmlspecialchars( $item->getField( 'title', KernelTools::tra( 'Component' ) ) ); if( !empty( $pParams['nolink'] ) ) { $ret = $title; } else { $url = htmlspecialchars( $item->getDisplayUrl() ); $ret = ''.$title.''; } } else { $ret = KernelTools::tra( "Unknown Component" ); } } else { $ret = KernelTools::tra( "Unknown Component" ); } return $ret; } function data_component_help() { $help = '
| ' . KernelTools::tra( "Key" ) . ' | ' .'' . KernelTools::tra( "Type" ) . ' | ' .'' . KernelTools::tra( "Comments" ) . ' | ' .'
|---|---|---|
| id | ' .'' . KernelTools::tra( "numeric") . ' ' . KernelTools::tra("(required)") . ' | '
.'' . KernelTools::tra( "Component id number of the component to link to." ) . ' | ' .'
| nolink | ' .'' . KernelTools::tra( "key-words") . ' ' . KernelTools::tra("(optional)") . ' | '
.'' . KernelTools::tra( "Display the component title without a hyperlink." ) . ' | ' .'