Add city breadcrumbs element

@param $id
@return bool
343698
public function breadcrumbs_add_city($id) {
		bimport('regions.general');
		$bregions = BRegions::getInstance();
		$city = $bregions->city_get($id);
		if (empty($city)) {
			return false;
		}
		$region = $city->getregion();
		if (empty($region)) {
			return false;
		}
		$subcities = $region->cities_get_all();
		//
		$brouter = BRouter::getInstance();
		$url = '//' . $brouter->generateURL('regions', BLang::$langcode, array('view' => 'city', 'id' => $id));
		$name = $city->getname();
		if (!empty($subcities)) {
			$children = array();
			foreach ($subcities as $c) {
				$children[$c->id] = (object)array('active' => true, 'url' => '//' . $brouter->generateURL('regions', BLang::$langcode, array('view' => 'city', 'id' => $c->id)), 'name' => $c->getname());
			}
			return $this->breadcrumbs_add($url, $name, true, 'city', $children);
		}
		return $this->breadcrumbs_add($url, $name, true, 'city');
	}
364585
public function edit($id)
    {
        $content = $this->content->findById($id);

        if (! $content) {
            return $this->handleError(trans('soda::errors.not-found', ['object' => trans('soda::terminology.content')]));
        }

        $content->load('blockTypes.fields', 'type.blockTypes.fields', 'type.fields');
        $blockTypes = $this->content->getAvailableBlockTypes($content);

        $this->buildBreadcrumbTree($content);
        app('soda.interface')->setHeading($content->name);

        return view($content->edit_action, compact('content', 'blockTypes'));
    }
808531
public function breadcrumbs_add_catregion($catid, $id) {
		bimport('regions.general');
		bimport('classified.general');
		$bregions = BRegions::getInstance();
		$regions = $bregions->regions_get_all();
		$reg = $bregions->region_get($id);
		if (empty($reg)) {
			return false;
		}
		$bclassified = BClassified::getInstance();
		$cat = $bclassified->getcatbyid($catid);
		if (empty($cat)) {
			return false;
		}
		$brouter = BRouter::getInstance();
		$url = '//' . $brouter->generateURL('classified', BLang::$langcode, array('view' => 'category_region', 'category' => $catid, 'region' => $id));
		$children = array();
		foreach ($regions as $r) {
			$children[$r->id] = (object)array('active' => true, 'url' => '//' . $brouter->generateURL('classified', BLang::$langcode, array('view' => 'category_region', 'category' => $catid, 'region' => $r->id)), 'name' => $r->getname());
		}
		$name = $reg->getname();
		return $this->breadcrumbs_add($url, $name, true, 'region', $children);
	}
663774
public function add(string $id): self
    {
        if (!isset($this->data[$id])) {
            $registeredAddon = \BearFramework\Addons::get($id);
            if ($registeredAddon === null) {
                throw new \Exception('The addon ' . $id . ' is not registered!');
            }
            $registeredAddonOptions = $registeredAddon->options;
            if (isset($registeredAddonOptions['require']) && is_array($registeredAddonOptions['require'])) {
                foreach ($registeredAddonOptions['require'] as $requiredAddonID) {
                    if (is_string($requiredAddonID) && !isset($this->data[$requiredAddonID])) {
                        $this->add($requiredAddonID);
                    }
                }
            }

            $dir = $registeredAddon->dir;
            $this->data[$id] = new \BearFramework\App\Addon($id, $dir);
            $this->app->contexts->add($dir);
        }
        return $this;
    }
113996
public function breadcrumbs_add_catcity($catid, $id) {
		bimport('regions.general');
		bimport('classified.general');
		$bregions = BRegions::getInstance();
		$city = $bregions->city_get($id);
		if (empty($city)) {
			return false;
		}
		$region = $city->getregion();
		if (empty($region)) {
			return false;
		}
		$bclassified = BClassified::getInstance();
		$cat = $bclassified->getcatbyid($catid);
		if (empty($cat)) {
			return false;
		}
		$subcities_unsorted = $region->cities_get_all();
		$subcities = array();
		//Sort cities...
		foreach ($subcities_unsorted as $sc) {
			$subcities[] = $sc;
		}
		$n = count($subcities);
		for ($i = 0; $i < $n; $i++) {
			$m = $i;
			for ($j = $i; $j < $n; $j++) {
				if ($subcities[$j]->citycompare($subcities[$m]) < 0) {
					$m = $j;
				}
			}
			if ($m != $i) {
				$t = $subcities[$m];
				$subcities[$m] = $subcities[$i];
				$subcities[$i] = $t;
			}
		}
		//Add cities..
		$brouter = BRouter::getInstance();
		$url = '//' . $brouter->generateURL('classified', BLang::$langcode, array('view' => 'category_city', 'category' => $catid, 'city' => $id));
		$name = $city->getname();
		if (!empty($subcities)) {
			$children = array();
			foreach ($subcities as $c) {
				$children[$c->id] = (object)array('active' => true, 'url' => '//' . $brouter->generateURL('classified', BLang::$langcode, array('view' => 'category_city', 'category' => $catid, 'city' => $c->id)), 'name' => $c->getname());
			}
			return $this->breadcrumbs_add($url, $name, true, 'city', $children);
		}
		return $this->breadcrumbs_add($url, $name, true, 'city');
	}
1346019
public function setAdmins($id)
    {
        if (is_array($id)) {
            $id = implode(',', $id);
        }

        return $this->addTag('fb', 'admins', $id);
    }
282126
public function addWidget($id)
    {
        if (!(int)$id) return $this;
        $this->widgets[] = $this->application->getWidget( (int)$id );
        return $this;  
    }
604049
private function addServiceAlias($alias, $id)
    {
        if ($id->isPublic()) {
            return sprintf("    %s: '@%s'\n", $alias, $id);
        }

        return sprintf("    %s:\n        alias: %s\n        public: false\n", $alias, $id);
    }
337060
private function addOpeningNav(string $id): string
    {
        $output = '<nav ';
        if ($id !== '') $output .= 'id="' . $id . '" ';
        $output .= 'class="navbar navbar-' . $this->options['theme']['fore'];
        if (!empty($this->options['theme']['back'])) $output .= " bg-" . $this->options['theme']['back'];
        if ($this->options['mobile']) {
            $output .= ' navbar-expand-' . $this->options['mobileSize'];
        } else {
            $output .= ' navbar-expand';
        }
        if (!empty($this->options['theme']['color'])) $output .= '" style="background-color: #' . $this->options['theme']['color'];
        $output .= '">';
        return $output;
    }
984404
public function add($id, $data = 1)
    {
        try {
            return $this->resource->hSet(static::CACHE_KEY, $id, $data);
        } catch (ConnectionException $e) {
            return false;
        }
    }
1315134
public function addExternal($network, $id)
	{

		if (!(int)$network)
		{
			if (!isset(self::$social[$network])) return $this;
			$network = self::$social[$network];
		}

        $this->getDbConnection()->delete('users_external', array(
                'external_type' => $network, 
                'external_id'   => $id,
        ));		
		
        $this->getDbConnection()->insert('users_external', array(
                'user_id'       => $this->id, 
                'external_type' => $network, 
                'external_id'   => $id,
        ));
			
	    $this->_external = null;
			
        return $this;  		
		
	}
1133934
protected function setBreadcrumbListCity()
    {
        $breadcrumbs = array();

        $breadcrumbs[] = array(
            'url' => $this->url('admin'),
            'text' => $this->text('Dashboard')
        );

        $breadcrumbs[] = array(
            'url' => $this->url('admin/settings/country'),
            'text' => $this->text('Countries')
        );

        $breadcrumbs[] = array(
            'url' => $this->url("admin/settings/states/{$this->data_country['code']}"),
            'text' => $this->text('Country states of %name', array('%name' => $this->data_country['name']))
        );

        $this->setBreadcrumbs($breadcrumbs);
    }
871088
public function addBreadcrumb(Breadcrumb $breadcrumb)
    {
        $data = $breadcrumb->toArray();

        if ($metaData = $this->cleanupObj($breadcrumb->getMetaData(), true)) {
            $data['metaData'] = $metaData;

            if (strlen(json_encode($data)) > Breadcrumb::MAX_SIZE) {
                unset($data['metaData']);
            }
        }

        $this->breadcrumbs[] = $data;
    }
369779
protected function getBasketElement($id)
    {
        $basketElement = $this->basketElementManager->findOneBy(['id' => $id]);

        if (null === $basketElement) {
            throw new NotFoundHttpException(sprintf('Basket element (%d) not found', $id));
        }

        return $basketElement;
    }
7620
public function addLineages($id, $data) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Skill not found.']);
		}

		// pass add to internal logic
		try {
			$this->doAddLineages($model, $data);
		} catch (ErrorsException $e) {
			return new NotValid(['errors' => $e->getErrors()]);
		}

		// save and dispatch events
		$this->dispatch(SkillEvent::PRE_LINEAGES_ADD, $model, $data);
		$this->dispatch(SkillEvent::PRE_SAVE, $model, $data);
		$rows = $model->save();
		$this->dispatch(SkillEvent::POST_LINEAGES_ADD, $model, $data);
		$this->dispatch(SkillEvent::POST_SAVE, $model, $data);

		if ($rows > 0) {
			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
208140
public
    function edit($id)
    {
        return $this->view(["row" => Model::findOrFail($id),'template'=>Template::pluck('title','id')->toArray()], "pages::admin.edit");
        //
    }
999930
public function menu($id)
    {
        $this->loadModel('Menu.Menus');
        $menu = $this->Menus->get($id);
        $links = $this->Menus->MenuLinks->find()
            ->where(['menu_id' => $menu->id])
            ->order(['lft' => 'ASC'])
            ->all()
            ->map(function ($link) {
                $link->set('expanded', true);

                return $link;
            })
            ->nest('id', 'parent_id');

        if (!empty($this->request->data['tree_order'])) {
            $items = json_decode($this->request->data['tree_order']);

            if (!empty($items)) {
                unset($items[0]);
                $entities = [];

                foreach ($items as $key => $item) {
                    $link = $this->Menus->MenuLinks->get($item->item_id);
                    $link = $this->Menus->MenuLinks->patchEntity($link, [
                        'parent_id' => intval($item->parent_id),
                        'lft' => intval(($item->left - 1)),
                        'rght' => intval(($item->right - 1)),
                    ], ['validate' => false]);
                    $entities[] = $link;
                }

                $this->Menus->MenuLinks->connection()->transactional(function () use ($entities) {
                    foreach ($entities as $entity) {
                        $result = $this->Menus->MenuLinks->save($entity);
                        if (!$result) {
                            return false;
                        }
                    }

                    return true;
                });

                // don't trust "left" and "right" values coming from user's POST
                $this->Menus->MenuLinks->addBehavior('Tree', ['scope' => ['menu_id' => $menu->id]]);
                $this->Menus->MenuLinks->recover();
                $this->Flash->success(__d('menu', 'Menu has been reordered'));
            } else {
                $this->Flash->danger(__d('menu', 'Invalid information, check you have JavaScript enabled'));
            }

            $this->redirect($this->referer());
        }

        $disabledIds = $links
            ->match(['status' => false])
            ->extract('id')
            ->toArray();

        $this->title(__d('menu', 'Menu’s Links'));
        $this->set(compact('menu', 'links', 'disabledIds'));
        $this->Breadcrumb
            ->push('/admin/menu/manage')
            ->push(__d('menu', 'Editing menu'), ['plugin' => 'Menu', 'controller' => 'manage', 'action' => 'edit', $menu->id])
            ->push(__d('menu', 'Links'), '#');
    }