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

The AMI_ModPlaceholderView class

AMI_View
   |
   --AMI_ModPlaceholderView

• Introduction

Module component view abstraction with placeholders support.

• Class synopsis

AMI_ModPlaceholderView extends AMI_View {
/* Properties */
// Elements template (placeholders)
protected array $aPlaceholders = array();
/* Inherited Properties */
// Locale
protected AMI_View::$aLocale = array();
// Scope
protected AMI_View::$aScope = array();
// Locale file name
protected AMI_View::$localeFileName = '';
// Model
protected AMI_View::$oModel = null;
// Template block name
protected AMI_View::$tplBlockName = '';
// Template file name
protected AMI_View::$tplFileName = '';
/* Methods */
// Constructor.
public __construct ( ) returns AMI_ModPlaceholderView;
// Add new field placeholders into placeholder list using AMI_ModPlaceholderView::putPlaceholder() without sections.
public addPlaceholders ( $aPlaceholders ) returns AMI_ModPlaceholderView;
// Puts placeholder into required position.
public putPlaceholder ( string $name, [ string $positions = '' ], [ bool $isSection = false ] ) returns bool|int;
/* Inherited Methods */
// Constructor.
public AMI_View::__construct ( ) returns AMI_View;
// Adds locale.
public AMI_View::addLocale ( $aLocale, [ bool $doOverwrite = true ] ) returns AMI_View;
// Adds script code.
public AMI_View::addScriptCode ( string $code ) returns AMI_View;
// Adds script file.
public AMI_View::addScriptFile ( string $file ) returns AMI_View;
// Returns view data.
public AMI_View::get ( ) returns mixed;
// Initialize, processing after setting model.
public AMI_View::init ( ) returns AMI_View;
// Adds locale from resource.
public AMI_View::setModel ( mixed $oModel, [ $aLocale = array() ], string $path ) returns AMI_View;
// Set module id.
public AMI_View::setModId ( string $modId ) returns void;
// Sets view scope.
public AMI_View::setScope ( $aScope ) returns AMI_View;
protected AMI_View::addOpenGraphTags ( $header, $description, [ $image = '' ] ) returns void;
// Returns module id.
protected AMI_View::getModId ( ) returns string;
// Returns module specific locale path.
protected AMI_View::getModLocalePath ( ) returns string;
// Returns prepared view scope.
protected AMI_View::getScope ( string $type, [ $aScope = array() ] ) returns array;
// Returns template object.
protected AMI_View::getTemplate ( ) returns AMI_iTemplate;
// Parses block template and returns the result as a string.
protected AMI_View::parse ( string $setName, [ $aScope = array() ] ) returns string;
// Sets up model object.
protected AMI_View::_setModel ( mixed $oModel ) returns AMI_View;
}

• Class Details

Form and list views have placeholder support allowing flexible fields/columns manipulations.
Tags:
abstract
since 5.12.0

• Class Properies

protected array $aPlaceholders

Elements template (placeholders)

Can be redefined in child classes.

Example:

  •  // AMI_ModFormView
  •  protected $aPlaceholders array(
  •      '#form'// opening 'form' placeholder
  •          'public''id_page''id_cat''date_created''header''announce''body',
  •          '#seo''seo'// empty 'seo' placeholder
  •      'form' // closing 'form' placeholder
  •  );

• Class Methods

// Add new field placeholders into placeholder list using AMI_ModPlaceholderView::putPlaceholder() without sections.
public addPlaceholders ( $aPlaceholders ) returns AMI_ModPlaceholderView;
  • array $aPlaceholders
    Array of placeholders where keys are names and values are positions.
  Example:
  •  // AmiSample_FilterView
  •  public function __construct(){
  •      parent::__construct();
  •  
  •      // Add admin filter form placeholder for 'nickname' before 'datefrom' filter field
  •      $this->addPlaceholders(array('nickname' => 'datefrom.before'));
  •  }
// Puts placeholder into required position.
public putPlaceholder ( string $name, [ string $positions = '' ], [ bool $isSection = false ] ) returns bool|int;
  • string $name
    Placeholder name (same as field name)
  • string $positions
    Placeholder positions in format {placeholder[.position][|placeholder[.position]|[...]]}, where:
    • placeholder - existing placeholder;
    • position - begin|end|before|after, after by default, order explanation using AMI_ModPlaceholderView::$aPlaceholders: seo.before < seo.begin < seo.end < seo.after
    Each placeholder will search for positions separated by '|' and will be placed at first exiting position.

  • bool $isSection
    Section flag, if passed true secotion will be created
Array of placeholders where keys are field names and values are positions.

  Example:
  •  // AmiSample_FilterView
  •  public function __construct(){
  •      parent::__construct();
  •  
  •      // Add admin filter form placeholder for 'nickname' before 'datefrom' filter field
  •      $this->putPlaceholder('nickname''datefrom.before');
  •  }