> For the complete documentation index, see [llms.txt](https://xoops.gitbook.io/xmf-cookbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xoops.gitbook.io/xmf-cookbook/recipes/module-admin-pages/hide-and-seek-with-icons.md).

# Hide and Seek with Icons

As XOOPS matures, the icons won't be in the same place. There are static methods in [Xmf\Module\Admin](/xmf-cookbook/reference/module/admin.md) to help you win the game of hide and seek once and for all.

## Where are the icons?

You might have had some code that looks like this:

```php
$dirname         = basename(dirname(dirname(__FILE__)));
$module_handler  = xoops_gethandler('module');
$module          = $module_handler->getByDirname($dirname);
$pathIcon16      = $module->getInfo('icons16');
$img_src         = $pathIcon16 . '/delete.png';
```

Here is an XMF version that accomplishes the same thing, in a migration ready way:

```php
$img_src = \Xmf\Module\Admin::iconUrl('delete.png', 16);
```

You can also specify 32 for the size to get the larger size. And you don't have to worry about where the system icon library is hiding this time, as you will get back a full URL.

## menu.php

Administration area menus are one place where icon location changes cause problems.

Here is an example of an old menu.php:

```php
$dirname = basename(dirname(dirname(__FILE__)));
$module_handler = xoops_gethandler('module');
$module = $module_handler->getByDirname($dirname);
$pathIcon32 = $module->getInfo('icons32');

$adminmenu=array();
// Index
$adminmenu[] = array(
    'title'    => _MI_DEMO_ADMIN_INDEX ,
    'link'    => 'admin/index.php' ,
    'icon'    => '../../' . $pathIcon32 . '/home.png'
) ;
// About
$adminmenu[] = array(
    'title'    => _MI_DEMO_ADMIN_ABOUT ,
    'link'    => 'admin/about.php' ,
    'icon'    => '../../' . $pathIcon32 . '/about.png'
) ;
```

Here is a sample of how we can rewrite menu.php to work now and later with XMF.

```php
// get path to icons
$pathIcon32='';
if (class_exists('Xmf\Module\Admin', true)) {
    $pathIcon32 = \Xmf\Module\Admin::menuIconPath('');
}

$adminmenu=array();
// Index
$adminmenu[] = array(
    'title'    => _MI_DEMO_ADMIN_INDEX ,
    'link'    => 'admin/index.php' ,
    'icon'    => $pathIcon32.'home.png'
) ;
// About
$adminmenu[] = array(
    'title'    => _MI_DEMO_ADMIN_ABOUT ,
    'link'    => 'admin/about.php' ,
    'icon'    => $pathIcon32.'about.png'
) ;
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://xoops.gitbook.io/xmf-cookbook/recipes/module-admin-pages/hide-and-seek-with-icons.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
