protected function createLink(DataGrid $grid, $href, $params)
	{
		$targetComponent = $grid;

		if (strpos($href, ':') !== false) {
			return $grid->getPresenter()->link($href, $params);
		}

		for ($iteration = 0; $iteration < 10; $iteration++) {
			$targetComponent = $targetComponent->getParent();

			if ($targetComponent === null) {
				$this->throwHierarchyLookupException($grid, $href, $params);
			}

			try {
				@$link = $targetComponent->link($href, $params);

			} catch (InvalidLinkException $e) {
				$link = false;
			} catch (Nette\InvalidArgumentException $e) {
				$link = false;
			}

			if ($link) {
				if (
					strpos($link, '#error') === 0 ||
					(strrpos($href, "!") !== false && strpos($link, '#') === 0) ||
					(in_array($grid->getPresenter()->invalidLinkMode, [Presenter::INVALID_LINK_WARNING, Presenter::INVALID_LINK_SILENT], true) && strpos($link, '#') === 0)
				) {
					continue; // Did not find signal handler
				}

				return $link; // Found signal handler!
			} else {
				continue; // Did not find signal handler
			}

			if ($targetComponent instanceof Presenter) {
				// Went the whole way up to the UI\Presenter and did not find any signal handler
				$this->throwHierarchyLookupException($grid, $href, $params);
			}
		}

		// Went 10 steps up to the UI\Presenter and did not find any signal handler
		$this->throwHierarchyLookupException($grid, $href, $params);
	}
protected function createLink(DataGrid $grid, $href, $params)
	{
		$targetComponent = $grid;

		if (strpos($href, ':') !== false) {
			return $grid->getPresenter()->link($href, $params);
		}

		for ($iteration = 0; $iteration < 10; $iteration++) {
			$targetComponent = $targetComponent->getParent();

			if ($targetComponent === null) {
				$this->throwHierarchyLookupException($grid, $href, $params);
			}

			try {
				@$link = $targetComponent->link($href, $params);

			} catch (InvalidLinkException $e) {
				$link = false;
			} catch (Nette\InvalidArgumentException $e) {
				$link = false;
			}

			if ($link) {
				if (
					strpos($link, '#error') === 0 ||
					(strrpos($href, "!") !== false && strpos($link, '#') === 0) ||
					(in_array($grid->getPresenter()->invalidLinkMode, [Presenter::INVALID_LINK_WARNING, Presenter::INVALID_LINK_SILENT], true) && strpos($link, '#') === 0)
				) {
					continue; // Did not find signal handler
				}

				return $link; // Found signal handler!
			} else {
				continue; // Did not find signal handler
			}

			if ($targetComponent instanceof Presenter) {
				// Went the whole way up to the UI\Presenter and did not find any signal handler
				$this->throwHierarchyLookupException($grid, $href, $params);
			}
		}

		// Went 10 steps up to the UI\Presenter and did not find any signal handler
		$this->throwHierarchyLookupException($grid, $href, $params);
	}
protected function createLink ( DataGrid $ grid , $ href , $ params ) { $ targetComponent = $ grid ; if ( strpos ( $ href , ':' ) !== false ) { return $ grid -> getPresenter ( ) -> link ( $ href , $ params ) ; } for ( $ iteration = 0 ; $ iteration < 10 ; $ iteration ++ ) { $ targetComponent = $ targetComponent -> getParent ( ) ; if ( $ targetComponent === null ) { $ this -> throwHierarchyLookupException ( $ grid , $ href , $ params ) ; } try { @ $ link = $ targetComponent -> link ( $ href , $ params ) ; } catch ( InvalidLinkException $ e ) { $ link = false ; } catch ( Nette \ InvalidArgumentException $ e ) { $ link = false ; } if ( $ link ) { if ( strpos ( $ link , '#error' ) === 0 || ( strrpos ( $ href , "!" ) !== false && strpos ( $ link , '#' ) === 0 ) || ( in_array ( $ grid -> getPresenter ( ) -> invalidLinkMode , [ Presenter :: INVALID_LINK_WARNING , Presenter :: INVALID_LINK_SILENT ] , true ) && strpos ( $ link , '#' ) === 0 ) ) { continue ; // Did not find signal handler } return $ link ; // Found signal handler! } else { continue ; // Did not find signal handler } if ( $ targetComponent instanceof Presenter ) { // Went the whole way up to the UI\Presenter and did not find any signal handler $ this -> throwHierarchyLookupException ( $ grid , $ href , $ params ) ; } } // Went 10 steps up to the UI\Presenter and did not find any signal handler $ this -> throwHierarchyLookupException ( $ grid , $ href , $ params ) ; }
Create link to custom destination
@param  DataGrid $grid
@param  string   $href
@param  array    $params
@return string
@throws DataGridHasToBeAttachedToPresenterComponentException
@throws \InvalidArgumentException
@throws DataGridLinkCreationException
Create link to custom destination