Overridden to use id instead of slug for links

{@inheritdoc}
428277
protected function _getEntityRoute(KModelEntityInterface $entity)
    {
        $package = $this->getIdentifier()->package;
        $view    = 'users';

        return $this->getRoute(sprintf('option=com_%s&view=%s&id=%s&format=json', $package, $view, $entity->id));
    }
457938
public function updateId()
    {
        if (empty($this->parentNode->key)) {
            $this->id = "{$this->keyDelimiter}$this->key{$this->keyDelimiter}";
        } else {
            $this->id = "{$this->parentNode->id}$this->keyDelimiter{$this->key}$this->keyDelimiter";
        }
        $this->id = preg_replace('/[#]{2,}/', self::DEFAULT_KEY_DELIMITER, $this->id);
    }
506733
public function handleEdit(int $id = null, array $request = [])
    {
        if ($id === null) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('navigations-page') . "?m=4");
            } else {
                return 'Redirect: ' . $this->router->generate('navigations-page') . "?m=4";
            }
        }
        $navigation = $this->core->api('Navigation/' . $id, 'GET')->run();
        if ($navigation['headers'][0][2] === 422) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('navigations-page') . "?m=4");
            } else {
                return 'Redirect: ' . $this->router->generate('navigations-page') . "?m=4";
            }
        } elseif (($navigation["headers"][0][2] - 200) * ($navigation["headers"][0][2] - 299) > 0) {
            return $this->templates->render("500", [
                "error" => $navigation['response'],
                "result" => ''
            ]);
        }
        $navigation = $navigation['response'];

        if (isset($request['class']) === true && $request['class'] === '') {
            unset($request['class']);
        }
        if (isset($request['link']) === true && $request['link'] === '') {
            unset($request['link']);
        }
        if (isset($request['navigation_id']) === true && $request['navigation_id'] === '') {
            unset($request['navigation_id']);
        }
        $validator = new \Valitron\Validator($request);
        $validator->rule('required', ['title']);
        $validator->rule('optional', ['class', 'link', 'navigation_id']);
        $validator->rule(function ($field, $value, array $params, array $fields) {
            return file_exists(rtrim(public_path(), '/') . $value) || (filter_var($value, FILTER_VALIDATE_URL) !== false);
        }, 'link')->message("{field} must be an external link or a local file path");
        $validator->rule(function ($field, $value, $params, $fields) {
            if (is_array($value) === true || preg_match('/\w+(,\s?\w+)*/', $value) === 1) {
                return true;
            }
            return false;
        }, "class")->message("{field} must be an array or comma-separated");
        $validator->rule(function ($field, $value, $params, $fields) {
            $navigation = Model\Navigation::find($value);
            if ($navigation === null) {
                return false;
            }
            return true;
        }, "navigation_id")->message("{field} must be child of a valid navigation link");
        if ($validator->validate() === false) {
            if (headers_sent() === false) {
                header('X-PHP-Response-Code: 422', true, 422);
            }
            $navigations_list = $this->core->api('Navigation/all/flatten', 'GET')->run();
            $pages = $this->core->api('Page/all', 'GET')->run();
            $pages_list = [];
            foreach ($pages['response'] as $key => $page) {
                if ($page->status === true) {
                    $pages_list[] = $page;
                }
            }
            return $this->templates->render("Main::Navigation", [
                "messages" => [
                    'error' => $validator->errors(),
                    'info' => '',
                    'success' => '',
                    'warning' => ''
                ],
                "navigations" => $navigations_list['response'],
                "pages" => $pages_list
            ]);
        }

        $response = $this->core->api('Navigation/' . $navigation->id, 'PUT')->run($request);

        if (headers_sent() === false) {
            foreach ($response["headers"] as $header) {
                header($header[0], $header[1], $header[2]);
            }
        }
        if ($response["headers"][0][2] === 422) {
            $navigations_list = $this->core->api('Navigation/all/flatten', 'GET')->run();
            $pages = $this->core->api('Page/all', 'GET')->run();
            $pages_list = [];
            foreach ($pages['response'] as $key => $page) {
                if ($page->status === true) {
                    $pages_list[] = $page;
                }
            }
            return $this->templates->render("Main::Navigation", [
                "messages" => [
                    'error' => $response['response'],
                    'info' => '',
                    'success' => '',
                    'warning' => ''
                ],
                "navigations" => $navigations_list['response'],
                "pages" => $pages_list
            ]);
        } elseif (($response["headers"][0][2] - 200) * ($response["headers"][0][2] - 299) <= 0) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('navigations-page') . "?m=2");
            } else {
                return 'Redirect: ' . $this->router->generate('navigations-page') . "?m=2";
            }
        } else {
            return $this->templates->render("500", [
                "error" => $response['response'],
                "result" => ''
            ]);
        }
    }
554470
public function resolveRouteBinding($slug){
		$id = static::decodeSlug($slug);
		return parent::where($this->getKeyName(), $id)->first();
	}
760991
public function url($id = null, $additionalEndpoint = null)
    {
        $endpoint = $this->endpoint();

        if (! is_null($id)) {
            $endpoint .= '/' . $id;
        }
        if (! is_null($additionalEndpoint)) {
            $endpoint .= '/' . $additionalEndpoint;
        }

        return $endpoint;
    }
63693
public function set_link(string $id, string $id_link = null): ?int
  {
    return $this->db->update($this->class_cfg['table'], [
      $this->fields['id_link'] => $id_link
    ], [
      $this->fields['id'] => $id
    ]);
  }
957
public function setId($id)
    {

        if (!is_null($id) && (!preg_match("/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/", $id))) {
            throw new \InvalidArgumentException("invalid value for $id when calling StackService., must conform to the pattern /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.");
        }

        $this->container['id'] = $id;

        return $this;
    }
893757
public function id() {
		$id = $this->slug;
		if ( ! empty( $this->parent ) ) {
			$id = $this->parent->id() . '-' . $this->slug;
		}

		return $id;
	}
1200766
public function makeUnique($id, $slug) {
        $repo = $this->getRepository();
        $scope = $this->getConfig('scope');

        /** @type \Titon\Db\Query $query */
        foreach ([
            $repo->select()->where($this->getConfig('slug'), $slug),
            $repo->select()->where($this->getConfig('slug'), 'like', $slug . '%')
        ] as $i => $query) {
            if ($scope) {
                $query->bindCallback($scope);
            }

            if ($id) {
                $query->where($repo->getPrimaryKey(), '!=', $id);
            }

            $count = $query->count();

            if ($count <= 0) {
                break;

            } else if ($i) {
                return $slug . '-' . $count;
            }
        }

        return $slug;
    }
1139866
public function formatUrl($slug, $blogId)
    {
        $this->load->model('blog/blog_model');
        return $this->blog_model->getBlogUrl($blogId) . '/' . $slug;
    }
397934
public function insertId($link = null)
    {
        is_null($link) && $link = $this->wlink;
        return $link->lastInsertId();
    }
277297
public function deleteAction($id)
    {
        /** @var Menus_Entity_Table_Menu $table */
        $table = ORM::getTable($this->plugin, 'Menu');
        /** @var Menus_Entity_Menu $menu */
        $menu = $table->find($id);

        if (!is_null($menu))
        {
            $table->delete($menu);
        }
        HTTP::redirect(str_replace('&amp;', '&', $this->ui->url()));
    }
1211098
function pathObjectUrl($entity, $type = LinkGeneratorService::TYPE_LINK_DEFAULT, array $parameters = array()) {
        if($entity === null){
            return "";
        }
        return $this->linkGeneratorService->generateOnlyUrl($entity, $type, $parameters);
    }
787543
public function prev_id( $id = null, $params_override = null ) {

		if ( null === $id ) {
			$id = $this->id();
		}

		$id = (int) $id;

		$params = array(
			'select'  => "`t`.`{$this->data->field_id}`",
			'where'   => "`t`.`{$this->data->field_id}` < {$id}",
			'orderby' => "`t`.`{$this->data->field_id}` DESC",
			'limit'   => 1,
		);

		if ( ! empty( $params_override ) || ! empty( $this->params ) ) {
			if ( ! empty( $params_override ) ) {
				$params = $params_override;
			} elseif ( ! empty( $this->params ) ) {
				$params = $this->params;
			}

			if ( is_object( $params ) ) {
				$params = get_object_vars( $params );
			}

			if ( 0 < $id ) {
				if ( isset( $params['where'] ) && ! empty( $params['where'] ) ) {
					$params['where']   = (array) $params['where'];
					$params['where'][] = "`t`.`{$this->data->field_id}` < {$id}";
				} else {
					$params['where'] = "`t`.`{$this->data->field_id}` < {$id}";
				}
			} elseif ( isset( $params['offset'] ) && 0 < $params['offset'] ) {
				$params['offset'] --;
			} elseif ( 0 < $this->row_number && ! isset( $params['offset'] ) && ! empty( $this->params ) ) {
				$params['offset'] = $this->row_number - 1;
			} else {
				return 0;
			}

			if ( isset( $params['orderby'] ) && ! empty( $params['orderby'] ) ) {
				if ( is_array( $params['orderby'] ) ) {
					foreach ( $params['orderby'] as $orderby => $dir ) {
						$dir = strtoupper( $dir );

						if ( ! in_array( $dir, array( 'ASC', 'DESC' ), true ) ) {
							continue;
						}

						if ( 'ASC' === $dir ) {
							$params['orderby'][ $orderby ] = 'DESC';
						} else {
							$params['orderby'][ $orderby ] = 'ASC';
						}
					}

					$params['orderby'][ $this->data->field_id ] = 'DESC';
				} elseif ( "`t`.`{$this->data->field_id}` DESC" !== $params['orderby'] ) {
					$params['orderby'] .= ", `t`.`{$this->data->field_id}` DESC";
				}
			}//end if

			$params['select'] = "`t`.`{$this->data->field_id}`";
			$params['limit']  = 1;
		}//end if

		$pod = pods( $this->pod, $params );

		$new_id = 0;

		if ( $pod->fetch() ) {
			$new_id = $pod->id();
		}

		$new_id = $this->do_hook( 'prev_id', $new_id, $id, $pod, $params_override );

		return $new_id;
	}
631266
public function edit($id)
    {
        $this->request->allowMethod(['get', 'put']);

        /** @var Page $page */
        $page = $this->Pages->get($id, ['contain' => ['Current', 'Attributes', 'Collections']]);

        ThemeManager::theme(Wasabi::setting('Cms.Theme.id'));

        if ($this->request->is('put')) {
            $page = $this->Pages->patchEntity($page, $this->request->data);
            if ($this->Pages->save($page)) {
                $this->Flash->success(__d('wasabi_cms', 'The page <strong>{0}</strong> has been saved.', $page->name));
                $this->redirect(['action' => 'index']);
                return;
            } else {
                $this->Flash->error($this->formErrorMessage);
            }
        } else {
            /** @var Content $current */
            $current = $page->current;
            if (!is_array($current) &&
                get_class($current) === 'Wasabi\Cms\Model\Entity\Content' &&
                $current->isNew()
            ) {
                $defaultLayout = ThemeManager::theme()->getLayout('Default');
                $page->current = [
                    (new Content())->set('content', json_encode($defaultLayout->content()))
                ];
            }
        }

        if ($page->meta_robots_index === null) {
            $page->meta_robots_index = (bool)Configure::read('Settings.Cms.SEO.meta-robots-index');
        }

        if ($page->meta_robots_follow === null) {
            $page->meta_robots_follow = (bool)Configure::read('Settings.Cms.SEO.meta-robots-follow');
        }

        $routes = $this->Routes
            ->findAllFor('Wasabi/Cms.Pages', $id, Wasabi::contentLanguage()->id)
            ->order([$this->Routes->aliasField('url') => 'asc']);

        $this->set([
            'page' => $page,
            'layouts' => ThemeManager::theme()->getLayoutsForSelect(),
            'availableModules' => ModuleManager::getAvailableModules(),
            'changeAttributesUrl' => Router::url([
                'plugin' => 'Wasabi/Cms',
                'controller' => 'Pages',
                'action' => 'attributes'
            ]),
            'attributes' => $page->getLayout()->attributes(),
            'routes' => $routes,
            'routeTypes' => RouteTypes::getForSelect(),
            'formRoute' => $this->Routes->newEntity([
                'type' => ($routes->count() >= 1) ? RouteTypes::TYPE_REDIRECT_ROUTE : RouteTypes::TYPE_DEFAULT_ROUTE
            ])
        ]);

        $this->render('add');
    }
399940
public function url($id, array $params = array())
    {
        $route = $this->getRoute($id);

        if (!isset($route)) {
            throw new \RuntimeException('Named route not found for id: '.$id);
        }

        $search = array();
        foreach ($params as $key => $value) {
            // try to match ':{key}' fragments and replace it with value
            $search[] = '#:'.preg_quote($key, '#').'\+?(?!\w)#';
        }

        $pattern = preg_replace($search, $params, $route[3]['pattern']);

        // Remove remnants of unpopulated, trailing optional pattern segments, escaped special characters
        return preg_replace('#\(/?:.+\)|\(|\)|\\\\#', '', $pattern);
    }
394298
function replaceURL(id, url, linkText) {
    if (!linkText) linkText = url
    replaceText(id, "<a href='" + url + "'>" + linkText + "</a>");
}