Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_ModTableItemMeta class

• Introduction

Model meta data processor.

• Class synopsis

AMI_ModTableItemMeta implements AMI_iModTableItemMeta {
/* Properties */
// Field names to generate meta
protected array $aFieldSources = array( 'header' => 'header', 'announce' => 'announce', 'body' => 'body' );
// Max sublink length
protected int $maxLen = 64;
// Max number words for sublink
protected int $maxWords = 5;
// Module id
protected string $modId;
// Prefix link for item sublink
protected string $prefixLink = '';
/* Methods */
// Event handler.
public addItemIdToSublink ( string $name, $aEvent, string $handlerModId, string $srcModId ) returns array;
// Check unique of item sublink and return conflict item model.
public getLinkConflictItem ( AMI_ModTable $oTable, string $newlink, [ string $sublinkFieldName = 'sublink' ], [ int|string $id = 0 ] ) returns AMI_ModTableItem|bool;
// Event handler.
public handleSaveModelItem ( string $name, $aEvent, string $handlerModId, string $srcModId ) returns array;
// Sublinks functionality.
public processSublink ( &$aEvent ) returns void;
// Check sublink symbols.
protected checkURLSymbols ( string $str ) returns boolean;
// Generate sublink from any string.
protected createSublink ( string $str, $aItemData ) returns string;
// Auto-generate sublink.
protected genAutoLink ( string $str, [ string $langTransliterate = "" ], [ string $forceLink = "" ], [ $aItemData = array() ] ) returns string;
// Returns HTML meta description.
protected getHTMLMetaDescription ( string $source, [ int $maxLength = 255 ] ) returns string;
// Returns HTML meta keywords.
protected getHTMLMetaKeywords ( string $source, string $locale, int $minLength, [ int $maxLength = 255 ] ) returns string;
// Returns HTML meta title.
protected getHTMLMetaTitle ( string $modId, string $locale, int $pageId, string $defaultTitle, AMI_ModTableItem $oItem ) returns string;
// Prepare string for sublink generation.
protected prepareSublink ( string $str ) returns string;
// HTML-meta fields functionality.
protected processHTMLMeta ( &$aEvent ) returns void;
}
Tags:
see AMI_ModTableItem::save()
since 5.14.4
resource {$modId}/table/item/model/meta AMI::getResource('{$modId}/table/item/model/meta')*

• Class Properies

protected array $aFieldSources

Field names to generate meta

protected int $maxLen

Max sublink length

protected int $maxWords

Max number words for sublink

protected string $modId

Module id

Prefix link for item sublink

• Class Methods

  • string $name
    Event name
  • array $aEvent
    Event data
  • string $handlerModId
    Handler module id
  • string $srcModId
    Source module id
Update item model (stored in $aEvent['oItem']) by adding ID to sublink variable ('-36')
// Check unique of item sublink and return conflict item model.
public getLinkConflictItem ( AMI_ModTable $oTable, string $newlink, [ string $sublinkFieldName = 'sublink' ], [ int|string $id = 0 ] ) returns AMI_ModTableItem|bool;
  • AMI_ModTable $oTable
    Item's table.
  • string $newlink
    Sublink value
  • string $sublinkFieldName
    Sublink field name
  • int|string $id
    Current item id
// Event handler.
public handleSaveModelItem ( string $name, $aEvent, string $handlerModId, string $srcModId ) returns array;
  • string $name
    Event name
  • array $aEvent
    Event data
  • string $handlerModId
    Handler module id
  • string $srcModId
    Source module id

Implementation of: AMI_iModTableItemMeta::handleSaveModelItem().

Creates/updates module table item model meta data.
  • array &$aEvent
    Event data
Tags:
todo Implement
// Check sublink symbols.
protected checkURLSymbols ( string $str ) returns boolean;
  • string $str
    Sublink
  • string $str
    Source string for sublink generation
  • array $aItemData
    Current item data that should be saved
  • string $str
    Source string for sublink generation
  • string $langTransliterate
    Locale for string transliteration
  • string $forceLink
    Force sublink
  • array $aItemData
    Current item data
// Returns HTML meta description.
protected getHTMLMetaDescription ( string $source, [ int $maxLength = 255 ] ) returns string;
  • string $source
    Source string
  • int $maxLength
    Maximum result length
// Returns HTML meta keywords.
protected getHTMLMetaKeywords ( string $source, string $locale, int $minLength, [ int $maxLength = 255 ] ) returns string;
  • string $source
    Source string
  • string $locale
    Locale
  • int $minLength
    Minimum keyword length
  • int $maxLength
    Maximum result length
// Returns HTML meta title.
protected getHTMLMetaTitle ( string $modId, string $locale, int $pageId, string $defaultTitle, AMI_ModTableItem $oItem ) returns string;
  • string $modId
    Module id
  • string $locale
    Locale
  • int $pageId
    Page id
  • string $defaultTitle
    Default title if there is no 'html_title_template' module option
  • AMI_ModTableItem $oItem
    Item
  • string $str
    Source string
// HTML-meta fields functionality.
protected processHTMLMeta ( &$aEvent ) returns void;
  • array &$aEvent
    Event data
Tags:
see AMI_ModTableItemMeta::handleSaveModelItem()
todo Avoid string type casting for 'is_kw_manual', 'filled'.