insert_item

Item-related functions

Summary

insert_item(array $metadata = Array, array $elementTexts = Array, array $fileMetadata = Array)

Insert a new item into the Omeka database.

Parameters:
  • $metadata (array) –

    Set of metadata options for configuring the item. Array which can include the following properties:

    • 'public' (boolean)
    • 'featured' (boolean)
    • 'collection_id' (integer)
    • 'item_type_id' (integer)
    • 'item_type_name' (string)
    • 'tags' (string, comma-delimited)
    • 'overwriteElementTexts' (boolean) -- determines whether or not to overwrite existing element texts. If true, this will loop through the element texts provided in $elementTexts, and it will update existing records where possible. All texts that are not yet in the DB will be added in the usual manner. False by default.
  • $elementTexts (array) –

    Array of element texts to assign to the item. This follows the format:

    array(
      [element set name] => array(
        [element name] => array(
          array('text' => [string], 'html' => [false|true]),
          array('text' => [string], 'html' => [false|true])
         ),
        [element name] => array(
          array('text' => [string], 'html' => [false|true]),
          array('text' => [string], 'html' => [false|true])
        )
      ),
      [element set name] => array(
        [element name] => array(
          array('text' => [string], 'html' => [false|true]),
          array('text' => [string], 'html' => [false|true])
        ),
        [element name] => array(
          array('text' => [string], 'html' => [false|true]),
          array('text' => [string], 'html' => [false|true])
        )
      )
    );
    
  • $fileMetadata (array) –

    Set of metadata options that allow one or more files to be associated with the item. Includes the following options:

    • 'file_transfer_type' (string = 'Url|Filesystem|Upload' or Omeka_File_Transfer_Adapter_Interface). Corresponds to the $transferStrategy argument for addFiles().
    • 'file_ingest_options' OPTIONAL (array of possible options to pass modify the behavior of the ingest script). Corresponds to the $options argument for addFiles().
    • 'files' (array or string) Represents information indicating the file to ingest. Corresponds to the $files argument for addFiles().
Returns:

Item

Usage

Examples

See Also

Project Versions

Table Of Contents

Previous topic

insert_files_for_item

Next topic

update_item

This Page