LLMS_Add_On::__construct( array $addon = array(), string $lookup_key = 'id' )

Constructor


Description Description


Parameters Parameters

$addon

(array) (Optional) array of addon data

Default value: array()

$lookup_key

(string) (Optional) if $addon is a string, this determines how to lookup the addon from the available list of addons

Default value: 'id'


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/models/model.llms.add-on.php

	public function __construct( $addon = array(), $lookup_key = 'id' ) {

		if ( is_string( $addon ) ) {

			$lookup_val = $addon;
			$addons = llms_get_add_ons();
			if ( ! empty( $addons['items'] ) ) {
				foreach ( $addons['items'] as $addon ) {

					if ( isset( $addon[ $lookup_key ] ) && $addon[ $lookup_key ] == $lookup_val ) {
						$this->data = $addon;
						break;
					}
				}
			}
		}

		$this->data = $addon;
		$this->id = $addon['id'];

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.22.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.





Permalink: