Возвращает массив данных для шаблона.

Массив предварительно наполняется часто используемыми переменными.

@return array

@since 1.00
480031
public function prepareTmplData()
	{
		$data = array();
		$data['plugin'] = $this->plugin;
		$data['page'] = Eresus_Kernel::app()->getPage();
		$data['Eresus'] = Eresus_CMS::getLegacyKernel();
		return $data;
	}
99165
public function getDirtyRawAttributes(): array
    {
        $attributes = $this->getRawAttributes();

        $cachedAttributes = $this->getCachedRawAttributes(array_keys($attributes));

        $dirty = [];

        foreach ($attributes as $key => $value) {
            if ($this->isActualRelation($key) || $key == 'pivot') {
                continue;
            }

            if (!array_key_exists($key, $cachedAttributes) && !$value instanceof Pivot) {
                $dirty[$key] = $value;
            } elseif ($value !== $cachedAttributes[$key] &&
                !$this->originalIsNumericallyEquivalent($value, $cachedAttributes[$key])) {
                $dirty[$key] = $value;
            }
        }

        return $dirty;
    }
406640
public function getFields(): array
    {
        $fields = $this->reflection->getSchema();

        foreach ($fields as $field => $type) {
            if ($this->isAggregation($type)) {
                unset($fields[$field]);
            }
        }

        return $fields;
    }
942504
public function describe() : array
    {
        $info = [
            'path' => $this->path,
            'maxDepth' => $this->maxDepth,
            'skipSymLinks' => $this->skipSymLinks,
            'dirs' => $this->dirs,
            'itemValue' => $this->itemValue,
            'traverseHidden' => $this->traverseHidden,
            'skipUnreadable' => $this->skipUnreadable,
            'requireUnique' => $this->requireUnique,
            // Count actual criteria.
            'criteriaCount' => (int) !$this->includeHidden,
            // First actual criteria.
            'includeHidden' => $this->includeHidden,
        ];
        $possible_empties = [
            'includeNames',
            'excludeNames',
            'includeExtensions',
            'excludeExtensions',
            'includeParents',
            'excludeParents',
            'customFilter',
        ];
        foreach ($possible_empties as $key) {
            if ($this->{$key}) {
                ++$info['criteriaCount'];
                $info[$key] = $this->{$key};
            }
        }
        return $info;
    }
694317
public function toArray(): array
    {
        return array_filter([
            'name' => $this->name,
            'counters' => array_values(array_map(function (Counter $counter) {
                return $counter->toArray();
            }, $this->counters)),
            'application_type' => Filter::AT_LEAST_ONE === $this->applicationType
                ? null
                : $this->applicationType,
            'total_elements' => 0 === $this->totalElements
                ? null
                : $this->totalElements,
            'active_elements' => array_values(array_map(function ($counter) {
                return ($counter instanceof Counter)
                    ? $counter->toArray()
                    : $counter;
            }, $this->activeElements)),
            'highest_active_level' => 0 === $this->highestActiveLevel
                ? null
                : $this->highestActiveLevel,
        ], function ($element) {
            return
            !(
                is_null($element) ||
                (is_array($element) && empty($element))
            );
        });
    }
1185733
public function getManagedModelTabs()
    {
        $forms = ArrayList::create();
        $mainModels = $this->getVersionedModels('main', true);

        foreach ($mainModels as $class => $title) {
            $classInst = Injector::inst()->get($class);
            if (ClassInfo::hasMethod($classInst, 'isArchiveFieldEnabled')
                && $classInst->isArchiveFieldEnabled()
            ) {
                $forms->push(ArrayData::create([
                    'Title' => $title,
                    'ClassName' => $class,
                    'Link' => $this->Link($this->sanitiseClassName($class)),
                    'LinkOrCurrent' => ($class === $this->modelClass) ? 'current' : 'link'
                ]));
            }
        }

        $otherModels = $this->getVersionedModels('other', true);
        if ($otherModels) {
            $isOtherActive = (
                $this->request->getVar('others') !== null ||
                array_key_exists($this->modelClass, $otherModels)
            );
            $forms->push(ArrayData::create([
                'Title' => _t(__CLASS__ . '.TAB_OTHERS', 'Others'),
                'ClassName' => 'Others',
                'Link' => $this->Link('?others=1'),
                'LinkOrCurrent' => ($isOtherActive ? 'current' : 'link')
            ]));
        }

        $forms->first()->LinkOrCurrent = 'link';

        return $forms;
    }
1142399
public function getCMSFields()
    {
        $fields = $this->scaffoldFormFields(
            array(
                // Don't allow has_many/many_many relationship editing before the record is first saved
                'includeRelations' => ($this->ID > 0),
                'tabbed' => true,
                'ajaxSafe' => true
            )
        );
        $fields->removeByName('MenuTitle');
        $fields->addFieldsToTab(
            'Root.Main',
            array(
                HiddenField::create('UniqueConfigTitle'),
                TextField::create(
                    'AdminTitle',
                    'Admin title'
                )
                ->setDescription('This field is for adminisration use only and will not display on the site.'),
                CheckboxField::create(
                    'ShowInMenus',
                    'Show in menus',
                    0
                ),
                DisplayLogicWrapper::create(
                    TextField::create(
                        'MenuTitle',
                        'Navigation label'
                    )
                )
                ->displayIf("ShowInMenus")->isChecked()->end()
            )
        );
        $fields->addFieldsToTab(
            'Root.Settings',
            array(
                CheckboxField::create(
                    'Public',
                    'Public',
                    1
                )
                ->setDescription('Is this section publicly accessible?.'),
                DropdownField::create(
                    'Style',
                    'Select a style',
                    $this->ConfigStyles
                )
                ->setEmptyString('Default')
            )
        );
        $this->extend('updateCMSFields', $fields);
        return $fields;
    }
6056
public function toArray()
    {
        return [
            'fallback'    => $this->fallback,
            'text'        => $this->text,
            'pretext'     => $this->preText,
            'color'       => $this->color,
            'footer'      => $this->footer,
            'mrkdwn_in'   => $this->useMarkdown ? ['text', 'pretext', 'footer'] : [],
            'footer_icon' => $this->footerIcon,
            'ts'          => $this->timestamp ? $this->timestamp->getTimestamp() : null,
            'image_url'   => $this->imageUrl,
            'thumb_url'   => $this->thumbUrl,
            'title'       => $this->title,
            'title_link'  => $this->titleLink,
            'author_name' => $this->authorName,
            'author_link' => $this->authorLink,
            'author_icon' => $this->authorIcon,
            'callback_id' => $this->callbackId,
            'fields'      => $this->fields->map(function (AttachmentField $field) {
                return $field->toArray();
            })->toArray(),
            'actions'     => $this->actions->map(function (AttachmentAction $action) {
                return $action->toArray();
            })->toArray(),
        ];
    }
731879
public function toArray()
    {
        return array(
            // account
            'accountName' => $this->getAccountName(),
            'uid' => $this->getUid(),
            // contact
            'title' => $this->getTitle(),
            'salutation' => $this->getSalutation(),
            'firstName' => $this->getFirstName(),
            'lastName' => $this->getLastName(),
            'email' => $this->getEmail(),
            'phone' => $this->getPhone(),
            'phoneMobile' => $this->getPhoneMobile(),
            // address
            'street' => $this->getStreet(),
            'number' => $this->getNumber(),
            'addition' => $this->getAddition(),
            'zip' => $this->getZip(),
            'city' => $this->getCity(),
            'state' => $this->getState(),
            'country' => $this->getCountry(),
            'note' => $this->getNote(),
            'contactAddress' => $this->getContactAddress() ? array(
                'id' => $this->getContactAddress()->getId()
            ) : null,
            // postbox
            'postboxCity' => $this->getPostboxCity(),
            'postboxNumber' => $this->getPostboxNumber(),
            'postboxPostcode' => $this->getPostboxPostcode(),
        );
    }
366775
public function getFieldChoices()
    {
        $fields = [];
        foreach ($this->getMeta()->getFields() as $field) {
            if (!$field->isRelation) {
                continue;
            }
            $fields[] = $field->getName();
        }

        foreach ($this->getMeta()->getReverseRelatedObjects() as $reverseRelatedObject) {
            if ($reverseRelatedObject->relation->fromField->isUnique()) {
                $fields[] = $reverseRelatedObject->relation->fromField->getRelatedQueryName();
            }
        }

        return $fields;
    }
211490
public function toArray() {
		return [
			'key' => $this->key(),
			'url' => $this->url(),
			'formData' => $this->formData(),
			'cacheControl' => $this->cacheControl(),
			'expires' => $this->expires(),
			'acl' => $this->acl()
		];
	}
480068
public function getItems(): array
    {
        $available = [];
        $assigned = [];

        if ($this->type == Item::TYPE_ROLE) {
            foreach (array_keys($this->manager->getRoles()) as $name) {
                $available[$name] = 'role';
            }
        }
        foreach (array_keys($this->manager->getPermissions()) as $name) {
            $available[$name] = $name[0] == '/' ? 'route' : 'permission';
        }

        foreach ($this->manager->getChildren($this->_item->name) as $item) {
            $assigned[$item->name] = $item->type == 1 ? 'role' : ($item->name[0] == '/' ? 'route' : 'permission');
            unset($available[$item->name]);
        }

        unset($available[$this->name]);

        return [
            'available' => $available,
            'assigned' => $assigned,
        ];
    }
72235
public function getRules()
    {
        $this->defaultParams['num_decimals']    = 2;
        $this->defaultParams['num_decimals']    = 2;
        $this->defaultParams['round_type']      = Formatter::ROUND_CLASSIC;
        $this->defaultParams['decimal_sep']     = '.';
        $this->defaultParams['thousands_sep']   = ' ';
        $this->defaultParams['format_positive'] = '%v %s';
        $this->defaultParams['format_negative'] = '-%v %s';

        return array(
            'eur' => array(
                'symbol' => '€',
                'rate'   => 1,
            ),

            'usd' => array(
                'symbol'          => '$',
                'format_positive' => '%s%v',
                'format_negative' => '-%s%v',
                'rate'            => 0.5,
            ),

            'rub' => array(
                'symbol'      => 'руб.',
                'decimal_sep' => ',',
                'rate'        => 0.02,
            ),

            'uah' => array(
                'symbol'      => 'грн.',
                'decimal_sep' => ',',
                'rate'        => 0.04,
            ),

            'byr' => array(
                'symbol'       => 'Br',
                'round_type'   => Formatter::ROUND_CEIL,
                'round_value'  => '-2',
                'num_decimals' => '0',
                'rate'         => 0.00005,
            ),

            '%'   => array(
                'symbol'          => '%',
                'format_positive' => '%v%s',
                'format_negative' => '-%v%s',
            ),
        );
    }
154510
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                HTMLEditorField::create(
                    'HeaderContent',
                    $this->fieldLabel('HeaderContent')
                )->setRows(10),
                HTMLEditorField::create(
                    'FooterContent',
                    $this->fieldLabel('FooterContent')
                )->setRows(10)
            ]
        );
        
        // Insert Links Tab:
        
        $fields->insertAfter(
            Tab::create(
                'Links',
                $this->fieldLabel('Links')
            ),
            'Main'
        );
        
        // Add Links Fields:
        
        $fields->addFieldsToTab(
            'Root.Links',
            [
                DropdownField::create(
                    'LinkMode',
                    $this->fieldLabel('LinkMode'),
                    $this->getLinkModeOptions()
                ),
                PageMultiselectField::create(
                    'LinkedPages',
                    $this->fieldLabel('LinkedPages')
                )
            ]
        );
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'NavigationOptions',
                $this->fieldLabel('NavigationOptions'),
                [
                    DropdownField::create(
                        'SortBy',
                        $this->fieldLabel('SortBy'),
                        $this->getSortByOptions()
                    ),
                    CheckboxField::create(
                        'ShowIcons',
                        $this->fieldLabel('ShowIcons')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
100656
public function getArrguments()
    {
        return [
            'model-name' => $this->modelName,
            '--resource-file' => $this->resourceFile,
            '--views-directory' => $this->viewsDirectory,
            '--routes-prefix' => $this->prefix,
            '--language-filename' => $this->languageFileName,
            '--layout-name' => $this->layout,
            '--template-name' => $this->template,
            '--force' => $this->force,
        ];
    }
759013
public function get_fields()
    {
        if( !isset( $this->fields ) )
        {
            if( !$this->has_sub_sections() )
            {
                $this->fields = $this->model['fields'];
            }
            else
            {
                $this->fields = array();
                foreach( $this->model['subsections'] as $subsection )
                {
                    foreach( $subsection['fields'] as $field )
                    {
                        $field->subsection = \Amarkal\Common\Tools::strtoslug( $subsection['title'] );
                    }
                    $this->fields = array_merge( $this->fields, $subsection['fields'] );
                }
            }
        }
        return $this->fields;
    }
474237
public function toArray()
    {
        $cartItemData = [
            'modelType' => $this->modelType,
            'modelId' => $this->modelId,
            'name' => $this->name,
            'price' => $this->price,
            'image' => $this->image,
            'quantity' => $this->quantity,
        ];

        if ($this->id) {
            $cartItemData['id'] = $this->id;
        }

        return $cartItemData;
    }