Description

The linker is a tool used to associate various parts of the website with each other.They are primarily used as a tool of navigational convenience.Therefore, the linker has several limitations:

  • the relationships are not relational (deleting one will not remove the relationship)
  • the relationships are ID to ID which means that queries on the relationship will be inefficient

Resources

The linker is supported through three tables in the database:

  • linker_sources – a list of generically named sources and how they map to gadgets in the framework.
  • linker_gadgets – a list of sources and targets defining the special rules of how to query resources when the linker tool is not used.For example, users can select preferred gauges without using the linker tool.The linker tool support those gauges even though they are not stored within linker_lists.
  • linker_lists – the list of source and target names and the IDs involved.

Additionally, the linker expects the gadgets involved to use some common methods of access.Primarily, it requires that a gadget implement a list state which takes as an argument named “list” a list of colon delimited ID numbers to produce a list of links that will lead the user to the appropriate resource.

Basic setup

  1. Add a source to the linker sources to the linker gadgets table
    1. source – is a short name to refer to the linker source that is agreed upon by all linked resources.It must be unique.
    2. Look up – is the name of the Lookup resource to find the source
    3. gadget – the name of the gadget with the list state
    4. mutual – whether the resource is added reciprocally on the target
    5. is_list – if the parameter takes the form of a list (should be set to true)
    6. State – the state to use to list the resources (sometimes different than “list”)
  2. Implement “list” state on the gadget referenced in the source.Typically, the gadget will look up the list of IDs passed to it and print them in some sort of list form with a link to their full public webpage.
  3. Call the linker gadget view state with the source set to the source of the calling gadget and the canonical ID of the resource that the calling gadget is currently processing.There is no requirement for inserting the linker.It will automatically at the linker button at the bottom of the page, and linked to correct resources in place.

Advanced Usage

The linker_sources table can be used to specify parameters that allow the linker efficient access to resources that may not be in the linker_lists table or to parameterize special relationships between a linker source and target.When the linker gadget is called and used with a source set to one of the sources in the linker_sources table in the target set to one of the targets, these advanced parameters takeover.

The parameters in the linker_sources table are merged with the parameters that are normally passed to the linker target.

The following is an overview of this table:

  1. Source – the source of the calling gadget, usually matching a source given in the linker_gadgets table
  2. target – an automatic target to check with the calling gadget
  3. State – the state of the target that should be called
  4. parameters – a serialized PHP array of arguments to pass to the target
    1. a parameter of _lnkvisible set to zero will make the resulting target invisible on the source page, thus disabling the target when called by the source
  5. location – the integer corresponding to the LOC_* constants defined in Page1.inc
  6. position – the higher the number, the lower on the page it will appear
Join AW and support river stewardship nationwide!