NAME

Koha::Contrib::ValueBuilder::RepeatableAutocomplete - Repeatable autcomplete value-builder for Koha

VERSION

version 1.006

SYNOPSIS

Koha::Contrib::ValueBuilder::RepeatableAutocomplete->build_builder_inline(
        {   target => '4',
            data   => [
              { label => 'ArchitektIn', value => 'arc' },
              # and more...
            ] ,
        }
    );
}

DESCRIPTION

Koha::Contrib::ValueBuilder::RepeatableAutocomplete helps building Koha Valuebuilder Plugins. Koha is the world's first free and open source library system.

This module implements some functions that will generate the JavaScript / jQuery needed by the Koha Edit Form to enable a simple autocomplete lookup, while also working with repeatable MARC21 fields.

Please take a look at the helper modules included in this distribution, which pack all the lookup values and their configuration into easy to use functions:

Functions

build_builder_inline

Build JS to handle a short inline autocomplete lookup (data is provided to the function, not loaded via AJAX etc). The field will be inferred from the form element the value_builder is bound to.

build_builder_inline(
      {   target    => '4',
          data      => [ { label=>"Foo", value=>'foo' }, ... ],
          minlength => 3.
      }
  );

Parameters:

build_builder_inline_multiple

Build JS to handle a short inline autocomplete lookup (data is provided to the function, not loaded via AJAX etc). The selected value will be inserted into multiple subfields. The field will be inferred from the form element the value_builder is bound to.

build_builder_inline(
      {   target_map => [
              { subfield=>'b', type=>'selected', key=>'value' },
              { subfield=>'a', type=>'selected', key=>'other' },
              { subfield=>'2', type=>'literal',  literal=>'rdacontent' }
          ],
          data      => [ { label=>"Foo", value=>'foo', other=>'FOO', }, ... ],
          minlength => 3.
      }
  );

Parameters:

Usage in Koha

You will need to write a value_builder Perl script and put it into /usr/share/koha/intranet/cgi-bin/cataloguing/value_builder. You can find some example value-builder scripts in example/. The should look something like this:

#!/usr/bin/perl
use strict;
use warnings;

use Koha::Contrib::ValueBuilder::RepeatableAutocomplete::RDA qw(creator);

return creator('de');

You than will have to enable this value_builder as a Plugin in the respective MARC21 Framework / field / subfield.

Thanks

for supporting Open Source and giving back to the community:

AUTHORS

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Thomas Klausner.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.