Returns the preview by key

@param string $key
@param string $elementType

@return Element|null
772213
public function getElement ($key, $elementType)
    {
        $elements = $this->getAllElements($elementType);

        return array_key_exists($key, $elements)
            ? $elements[$key]
            : null;
    }
621960
public static function getSectionMediaElements($key = null) {
		if(!is_null($key)) {
			return self::$_sectionMedia[$key];
		} else {
			$arrImages = self::$_sectionMedia['images'];
			$arrObjects = self::$_sectionMedia['embeddings'];
			$arrLinks = self::$_sectionMedia['links'];
			return array_merge($arrImages, $arrObjects, $arrLinks);
		}
	}
88040
public function getUsage(Elementtype $elementtype)
    {
        $event = new ElementtypeUsageEvent($elementtype);
        $this->dispatcher->dispatch(ElementtypeEvents::USAGE, $event);

        return $event->getUsage();
    }
931692
public function getLastToken($type, $key = 'type')
    {
        return $this->token()->orderBy('tokens.created_at', 'desc')->where($key, $type)->first();
    }
969032
public function getItem($key)
    {
        // Get the element from the buffer if still remains valid!
        if (in_array($key, $this->bufferKeys)) {
            $cacheItem = $this->buffer[$key];
            if ($cacheItem->getExpiresInSecs() > 1) {
                return $cacheItem;
            }
        }
        
        // Get the element from the cache!
        $result = $this->_cacheEngine->get($key);
        $cache = new CacheItem($key, $result, $result !== null);

        $this->addElementToBuffer($cache);

        return $cache;
    }
1284735
public static function first(array $data, ?string $key = null)
    {
        if (count($data) === 0) {
            return null;
        }
        reset($data);
        $element = current($data);
        if ($key !== null && is_array($element) && isset($element[$key])) {
            return $element[$key];
        }
        return $element;
    }
4226
protected static function getProfile($type, $key = null)
    {
        $type = strtolower($type);

        if (array_key_exists($type, static::$typeDefinitions)) {
            return static::$typeDefinitions[$type][$key];
        }

        if (array_key_exists($type, self::$typeDefinitions)) {
            return self::$typeDefinitions[$type][$key];
        }

        return null;
    }
512617
private function getChild($key)
    {
        $top = $this->params;

        foreach (explode($this->delimiter, $key) as $node) {
            if (!isset($top[$node])) {
                return null;
            }
            $top = $top[$node];
        }
        return $top;
    }
7312
public function get_element($elementname) {
        if ($this->_form->elementExists($elementname)) {
            return $this->_form->getElement($elementname);
        } else {
            return false;
        }
    }
1207279
public function findByKey(string $key) {
        if (!$this->root) {
            return null;
        }

        return $this->root->findByKey($key);
    }
1019512
public function getTemplate($key)
    {
        if (isset($this->templates[$key])) {
            return $this->templates[$key];
        }
        return null;
    }
683361
protected function getElem($key, ...$additionalKeys)
	{
		$el = $this->configElem($key, Html::el());

		foreach ($additionalKeys as $additionalKey) {
			$config = $this->fetchConfig($additionalKey);
			$el = $this->configElem($config, $el);
		}

		return $el;
	}
751193
public function getLastValue($key)
    {
        $nb = count($this->table);
        if ($nb>0) {
            return $this->table[$nb-1][$key];
        } else {
            return null;
        }
    }
570608
public function getRequired(string $key)
    {
        if (!$this->has($key)) {
            throw new \InvalidArgumentException('Element ' . $key . ' does not exist');
        }

        return $this->collection[$this->keyMap[strtolower($key)]];
    }
1167438
public function get($key) {
        return isset($this->_elements[$key]) ? $this->_elements[$key] : null;
    }
129108
protected function getItem($key, $type)
	{
		if(array_key_exists($type, $this->storage) && array_key_exists($key, $this->storage[$type]))
		{
			return $this->storage[$type][$key];
		}

		return null;
	}
403467
public function get($key)
    {
        switch ($key) {
            case 'writeCollections' :
                return $this->getWriteCollections();
                break;
            case 'readCollections' :
                return $this->getReadCollections();
                break;
        }

        if (isset($this->attributes[$key])) {
            return $this->attributes[$key];
        }

        return null;
    }