What Appears in Details

Is there a way for me to edit what appears under "details" when you expand the basic item view? I'd like include the unique identifier for the object. Thanks.

A plugin that uses the admin_items_browse_detailed_each hook would do the trick.

It would look something like this in your plugin

public function hookAdminItemsBrowseDetailedEach($args)
{
    $item = $args['item'];
    // $id  = dig up the identifier
    echo "ID: $id";
}

Is that something I would have to program into the code of my particular version of Omeka, or would that work the way other plugins work?

It would go into a plugin

Would it be possible for you to point me to a similar plug-in that I can model mine on? I am very new to programming. I actually now want to change the basic browse view to include identifier right under title, instead of having this in the detail view. I have not been able to find something quite like this in the list of available plug-ins or code recipes. Also, do you know if I need a special software package to write php files, or can I use a simple text editor? Thanks.

I'm guessing you are still talking about the admin-side views. In that case, you would be better off keeping it in the details view. Otherwise, you would have to alter the core admin theme, which would be overwritten every time you upgrade to new versions of Omeka.

We haven't released it yet, but for a task like this SearchByMetadata might be the closest analogy. It just uses a different filter, but otherwise the structure will be similar.

As to software to write php files, all you really need is a simple text editor, but as you go along you might discover more advanced features in your text editor, or want to experiment with IDEs (Integrated Development Environments). I'd say start with text editor, and as you progress experiment with other things and learn what's most useful to you! :)

Good luck!

Thanks for all your help. I have gone ahead and attempted to create a simple plugin. My plugin has only the basic plugin.ini file and php file (Identifier_Add-on.php). The plugin.ini file seems to work properly RE delivering metadata to the plugins admin screen in my Omeka installation. However, I am getting a "This is not a valid plugin" error on the page. I tried to model my code directly on the COINS code, because it appeared most simple. Below is the code from my php file. Am I missing something crucial? Thanks!

<?php
/**
* Identifer_Add-on *
* @copyright Copyright 2013 Adina Langer
* @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/

/**
* Identifier_Add-on Plugin.
*
{*/
class Identifier_Add-on extends Omeka_Plugin_Abstract
{
protected $_hooks = array(
'install'
'uninstall'
'admin_items_browse_simple_each'
);
/**
* Install the plugin
*/
public function hookInstall()

/**
* Uninstall the plugin
*/
public function hookUninstall()

/**
* Prints out the Identifier on the admin browse results page.
*/

public function hookadmin_items_browse_simple_each($args)
{
$item = $args['item'];
// $id = dig up the identifier
echo "ID: $id";
}}

Plugin names generally shouldn't have underscores or hyphens in them. They should just be CamelCased, with upper and lower case letters.

Then the plugin class would be CamelCasedPlugin.php.

Plus, in Omeka 2.0, the class to extend from is Omeka_Plugin_AbstractPlugin.

Thanks. I changed the name of the plugin to IdentifierAddon and the class to Omeka_Plugin_AbstractPlugin. I'm still having the same problem. Thanks for sending more ideas.

Could you try to show a map of the plugin's directory structure? Something like

/plugins/IdentifierAddOn
/plugins/IdentifierAddOn/IdentifierAddOnPlugin.php

etc. ?

Sure. Currently the directory looks like this:

/var/www/omeka//plugins/IdentifierAddon

/plugins/IdentifierAddon/IdentifierAddon.php
/plugins/IdenttifierAddon/plugin.ini

Since the code is very simple, I didn't think I needed any sub-folders.

Thanks.

I'm guessing that the main thing is the name of the plugin class. It should be:

class IdentifierAddonPlugin extends Omeka_Plugin_AbstractPlugin

Looks like there are a couple other little things, like missing commas and {}s, but I think the class name is probably the culprit.

Thanks. I'm still getting the same "invalid plugin" error message. Do you know if there's a way to get a more detailed error message so I can better attempt to debug the code?
My code now looks like the below. I went back to your original suggestion to call the details hook. Now I am just declaring a new class containing the function that you provided to me originally. Am I missing some important step?

<?php
/**
 * IdentiferAddon *
 * @copyright Copyright 2013 Adina Langer
 * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
 */

/**
 * IdentifierAddon Plugin.
 * @package Omeka\Plugins\IdentifierAddon
 *
 {*/
class IdentifierAddonPlugin extends Omeka_Plugin_AbstractPlugin
{
	protected $_hooks = array(
		 'admin_items_browse_detailed_each',
	);

    /**
     * Prints out the Identifier on the admin browse results page.
     */

    public function hookAdminItemsBrowseDetailedEach($args)
	{
	    $item = $args['item'];
	    // $id  = dig up the identifier
	    echo "ID: $id";
	}
}

ah. Sorry, I missed a couple detailed things. Omeka is fussy about some of the naming.

The name of the file should be IdentifierAddOnPlugin.php, and the name of the class exactly the same: IdentifierAddOnPlugin

I early reply screwed up the capitalization of the 'O'. The file name change should be the last thing

Ok. I made those changes, thanks. Also wasn't sure about the // $id = dig up the identifier in the original code you sent me, so I modified that part of the code based on some other documentation I found. Still not working. Starting to wonder if I'm missing something really basic and essential. Sorry to be a bother. Here's the current code:

'<?php
/**
* IdentifierAddOn *
* @copyright Copyright 2013 Adina Langer
* @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/

/**
* IdentifierAddOn Plugin.
* @package Omeka\Plugins\IdentifierAddOn
*
{*/
class IdentifierAddOnPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = array(
'admin_items_browse_detailed_each',
);

/**
* Prints out the Identifier on the admin browse results details page.
*/

public function hookAdminItemsBrowseDetailedEach($args)
{
$item = $args['item'];
// $id = dig up the identifier
set_current_item($item);
$id = item('ID');
echo "ID: $id";
}
}'

Oops-- code in prettier form.

<?php
/**
 * IdentifierAddOn *
 * @copyright Copyright 2013 Adina Langer
 * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
 */

/**
 * IdentifierAddOn Plugin.
 * @package Omeka\Plugins\IdentifierAddOn
 *
 {*/
class IdentifierAddOnPlugin extends Omeka_Plugin_AbstractPlugin
{
	protected $_hooks = array(
		 'admin_items_browse_detailed_each',
	);

    /**
     * Prints out the Identifier on the admin browse results details  page.
     */

    public function hookAdminItemsBrowseDetailedEach($args)
	{
	    $item = $args['item'];
	    // $id  = dig up the identifier
	set_current_item($item);
	$id = item('ID');
	    echo "ID: $id";
	}
}

I'm not sure what's going on with the capitalization stuff and the various comments and errors.

The rules here are pretty simple, but rigid. The folder name and the beginning of the "main" plugin filename must be exactly the same, including capitalization, and they should only consist of uppercase letters, lowercase letters, and numbers.

So, if the folder is named IdentifierAddOn, the filename must be IdentifierAddOnPlugin.php, and the class name within that file must be IdentifierAddOnPlugin. Whether the "O" is capital or lowercase doesn't make too much difference, but it must be consistent.

Following just those rules, you should be able to get past the "invalid plugin" error. You have to get Omeka to be able to load your plugin before any of the actual code will matter.

From what you most recently pasted, this is what the directory structure should look like to get the plugin to load:

plugins/IdentifierAddOn/
plugins/IdentifierAddOn/IdentifierAddOnPlugin.php
plugins/IdentifierAddOn/plugin.ini

This all assumes we're talking about Omeka 2.0.

Great! Thanks for explaining. Now that the plugin installs, I can debug the code! Hooray.