Renders link to edit note.
@param $model
@param $key
@param $index
@return string|null
495941
public function renderNoteLink($model, $key, $index)
    {
        return $this->note ? Html::tag('span', Yii::t('hipanel', 'Note') . ': ', ['class' => 'bold']) . XEditable::widget([
                'model' => $model,
                'attribute' => $this->note === true ? 'note' : $this->note,
                'pluginOptions' => $this->noteOptions,
            ]) : null;
    }
1053742
public function buildUrl(string $key, View $view, N2nLocale $n2nLocale) {
		return $view->buildUrlStr(MurlPage::id($key)->locale($n2nLocale));
	}
1314950
public function isEditable(Model $model)
    {
        if (! is_callable($this->getEdit())) {
            return false;
        }

        return $this->editable && parent::isEditable($model);
    }
429912
protected function handleKey($key, Model $model)
    {
        if (is_string($key) === true) {
            $model->setName($this->pool->encodingService->encodeString($key))
                ->setConnectorType(Connectors::ASSOCIATIVE_ARRAY);

            return;
        }

        $model->setName($key)->setConnectorType(Connectors::NORMAL_ARRAY);
    }
543846
protected function getFormattedValue(Model $model, string $key, $value)
    {
        // Apply defined get mutator
        if ($model->hasGetMutator($key)) {
            return $model->mutateAttribute($key, $value);
        }

        // Cast to native PHP type
        if ($model->hasCast($key)) {
            return $model->castAttribute($key, $value);
        }

        // Honour DateTime attribute
        if ($value !== null && in_array($key, $model->getDates(), true)) {
            return $model->asDateTime($value);
        }

        return $value;
    }
283625
protected function show_hide_link($column, $index) {
        global $OUTPUT;
        // Some headers contain <br /> tags, do not include in title, hence the
        // strip tags.

        $ariacontrols = '';
        for ($i = 0; $i < $this->pagesize; $i++) {
            $ariacontrols .= $this->uniqueid . '_r' . $i . '_c' . $index . ' ';
        }

        $ariacontrols = trim($ariacontrols);

        if (!empty($this->prefs['collapse'][$column])) {
            $linkattributes = array('title' => get_string('show') . ' ' . strip_tags($this->headers[$index]),
                                    'aria-expanded' => 'false',
                                    'aria-controls' => $ariacontrols);
            return html_writer::link($this->baseurl->out(false, array($this->request[TABLE_VAR_SHOW] => $column)),
                    $OUTPUT->pix_icon('t/switch_plus', get_string('show')), $linkattributes);

        } else if ($this->headers[$index] !== NULL) {
            $linkattributes = array('title' => get_string('hide') . ' ' . strip_tags($this->headers[$index]),
                                    'aria-expanded' => 'true',
                                    'aria-controls' => $ariacontrols);
            return html_writer::link($this->baseurl->out(false, array($this->request[TABLE_VAR_HIDE] => $column)),
                    $OUTPUT->pix_icon('t/switch_minus', get_string('hide')), $linkattributes);
        }
    }
1352740
protected function fillForModel($index, $model)
    {
        if (false === empty($model->propertiesIds) && false === empty($model->propertiesValues)) {
            //leave only not empty properties
            $workingProps = array_filter($model->propertiesValues, function ($e) {
                if (true === is_array($e)) {
                    foreach ($e as $val) {
                        return (count($val) > 0 && false === empty($val[0]));
                    }
                } else {
                    return false === empty($e);
                }
            });
            //collecting storages
            $storage = (new Query())
                ->from(PropertyStorage::tableName())
                ->select('id')
                ->indexBy('class_name')
                ->column();
            //selecting all applicable properties to work with
            $rawProps = (new Query())->from(Property::tableName())
                ->select(['id', 'key', 'storage_id', 'data_type'])
                ->where([
                    'id' => array_keys($workingProps),
                    'in_search' => 1
                ])
                ->all();
            $props = ArrayHelper::map($rawProps, 'id', 'key', 'storage_id');
            foreach ($storage as $className => $id) {
                if (false === isset($props[$id]) || true === empty($props[$id])) {
                    continue;
                }
                $indexData = self::prepareIndexData($className, $props[$id], $workingProps, $index, $model);
                if (false === empty($indexData)) {
                    $this->client->bulk($indexData);
                }
            }
        }
    }
1365926
public function link(Model $model)
    {
        if ( ! $this->routePrefix || ! $this->isPermitted) {
            return false;
        }

        // If the relation is morphTo, the key needs to be prepared with type:key identicator
        if ($this->isMorphTo) {
            // todo: this needs to be fixed
            $parentIndicator = $this->getMorphTypeForModel($this->modelClass) . ':' . $model->getKey();
        } else {
            $parentIndicator = $model->getKey();
        }

        return route($this->routePrefix . static::ROUTE_POSTFIX)
             . '?parent=' . $this->relation . ':' . $parentIndicator;
    }
967180
public function show($menu = null, $model = null)
    {
        return Redirect::route('admin.menus.menulinks.edit', [$menu->id, $model->id]);
    }
1099744
public function edit(Request $request, $key)
    {
        if ($request->wantsJson()) {
            return $this->validNotFoundJsonResponse();
        }

        $model = $this->findFirstByKey($key);

        if (!$model) {
            abort(404);
        }

        $view = $this->getViewLocation(__FUNCTION__);
        $this->checkViewExists($view);

        return response()->view($view, compact('model'));
    }
223786
public function showCommand(int $index)
    {
        $routes = $this->router->getRoutes();
        if (isset($routes[$index - 1])) {
            /** @var Route $route */
            $route = $routes[$index - 1];

            $this->outputLine('<b>Information for route ' . $index . ':</b>');
            $this->outputLine('  Name: ' . $route->getName());
            $this->outputLine('  Pattern: ' . $route->getUriPattern());
            $this->outputLine('  Defaults: ');
            foreach ($route->getDefaults() as $defaultKey => $defaultValue) {
                $this->outputLine('    - ' . $defaultKey . ' => ' . $defaultValue);
            }
            $this->outputLine('  Append: ' . ($route->getAppendExceedingArguments() ? 'true' : 'false'));
        } else {
            $this->outputLine('Route ' . $index . ' was not found!');
        }
    }
555900
protected function getFromCasts(Model $model, $key)
    {
        $casts = $this->getCasts($model);

        if (!isset($casts[$key])) {
            return '';
        }

        $cast = $casts[$key];

        foreach ($this->xTypeToCasts as $xType=>$casts) {
            if (in_array($cast, $casts)) {
                return $xType;
            }
        }

        return 'string';
    }
851476
protected function resolveResourceKey(Model $model, string $resourceKey = null):string
    {
        if (! is_null($resourceKey)) {
            return $resourceKey;
        }

        if (method_exists($model, 'getResourceKey')) {
            return $model->getResourceKey();
        }

        return $model->getTable();
    }
623783
protected function getModelByKey($model, $key)
    {
        if (is_string($model)) {
            $model = new $model;
        }

        /** @var Model $model */
        return $model->withoutGlobalScopes()->find($key);
    }
1239680
public function getEditUrl($id, array $parameters = [])
    {
        array_unshift($parameters, $this->getAlias(), $id);

        return route('admin.model.edit', $parameters);
    }
310107
public function write($model, $map)
    {
        // TODO: Implement write() method.
        $line = '';
        foreach ($map as $key => $assoc) {
            $params = $assoc->getFirstNameInFile();
            $value = $assoc->get($model, $key, $map);
            $line .= $this->fixed_size($value, $params);
        }
        fwrite($this->fp, $line . "\r\n");
    }
35579
private function renderRowContent($index = null, $item = null)
    {
        $elements = [];
        $columnIndex = 0;
        foreach ($this->columns as $column) {
            /* @var $column BaseColumn */
            $column->setModel($item);
            $elements[] = $this->renderCellContent($column, $index, $columnIndex++);
        }

        $content = Html::tag('div', implode("\n", $elements), $this->prepareRowOptions($index, $item));
        if ($index !== null) {
            $content = str_replace('{' . $this->getIndexPlaceholder() . '}', $index, $content);
        }

        return $content;
    }