Back to MenuType class

Method _getAssetParentId

protected int
_getAssetParentId
(\Joomla\CMS\Table\Table $table = null, mixed $id = null)
Method to get the parent asset under which to register this one.
Parameters
  • \Joomla\CMS\Table\Table $table A Table object for the asset parent.
  • int $id Id to look up
Returns
  • int
Since
  • 3.6
Class: MenuType
Project: Joomla

Method _getAssetParentId - Source code

/**
 * Method to get the parent asset under which to register this one.
 * By default, all assets are registered to the ROOT node with ID,
 * which will default to 1 if none exists.
 * The extended class can define a table and id to lookup.  If the
 * asset does not exist it will be created.
 *
 * @param   Table    $table  A Table object for the asset parent.
 * @param   integer  $id     Id to look up
 *
 * @return  integer
 *
 * @since   3.6
 */
protected function _getAssetParentId(Table $table = null, $id = null)
{
    $assetId = null;
    $asset = Table::getInstance('asset');
    if ($asset->loadByName('com_menus')) {
        $assetId = $asset->id;
    }
    return $assetId === null ? parent::_getAssetParentId($table, $id) : $assetId;
}