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

The AMI_ModFormView class

AMI_View
   |
   --AMI_ModPlaceholderView
      |
      --AMI_ModFormView

• Introduction

Module form component view abstraction.

• Class synopsis

AMI_ModFormView extends AMI_ModPlaceholderView implements AMI_iModFormView {
/* Constants */
// Tab state
const AMI_ModFormView::TAB_STATE_ACTIVE =  'active';
// Tab state
const AMI_ModFormView::TAB_STATE_COMMON =  'normal';
// Tab state
const AMI_ModFormView::TAB_STATE_DISABLED =  'disabled';
/* Properties */
// Form default elements template (placeholders)
protected array $aPlaceholders = array( '#form', 'public', 'id_dataset', 'id_page', 'id_cat', 'ext_custom_fields_addon', 'date_created', 'header', 'ext_adv', 'ext_image', 'ext_tags', 'ext_relations', '#ext_custom_fields_top', 'ext_custom_fields_top', '#default_tabset', '#announce_tab', 'announce', 'announce_tab', '#body_tab', 'body', 'body_tab', '#ext_custom_fields_tab', 'ext_custom_fields_tab', '#options_tab', 'disable_comments', 'sublink', 'html_title', 'html_keywords', 'html_description', 'og_image', 'details_noindex', '#ext_rating_values' ,'ext_rating_values', 'options_tab', 'default_tabset', '#ext_custom_fields_bottom', 'ext_custom_fields_bottom', 'form' );
// Placeholders custom data array.
protected array $aPlaceholdersData = array();
// View type
protected string $viewType = 'form';
/* 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_ModFormView;
// Returns section placeholders
public addField ( $aField, string $section ) returns array;
// Add new field into fields array.
public addSection ( string $name, string $position, [ string|array $displayByAction = NULL ] ) returns false|AMI_ModFormView;
// Add a tab to the tab container. See AMI_ModFormView::addTabContainer() for usage example.
public addTab ( string $name, string $container, [ string $state = self::TAB_STATE_COMMON ], [ string $position = '' ], [ string $displayByAction = NULL ] ) returns AMI_ModFormView;
// Add a tab container on the form.
public addTabContainer ( string $name, [ string $position = '' ] ) returns AMI_ModFormView;
// Merges specified template with current one. New sets will be added, exisiting sets will be overwritten.
public addTemplate ( string $path, [ string $placeholderName = null ], [ $aLocale = null ] ) returns AMI_ModFormView;
// Drop field from fields array.
public dropField ( string $fieldName ) returns AMI_ModFormView;
// Drop the tab from the tab container.
public dropTab ( string $name, [ string $container = '' ] ) returns AMI_ModFormView;
// Returns view data.
public get ( ) returns string;
// Allows change field at displaying form.
public getFieldHTML ( mixed $fieldName ) returns void;
// Initialize fields.
public init ( ) returns AMI_View;
// Set field data to render field.
public setFieldData ( string $name, mixed $data ) returns AMI_ModFormView;
// Setting up model item object.
/* Inherited Methods */
// Constructor.
public AMI_ModPlaceholderView::__construct ( ) returns AMI_ModPlaceholderView;
// Add new field placeholders into placeholder list using AMI_ModPlaceholderView::putPlaceholder() without sections.
// Puts placeholder into required position.
public AMI_ModPlaceholderView::putPlaceholder ( string $name, [ string $positions = '' ], [ bool $isSection = false ] ) returns bool|int;
// 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;
// Returns prepared view scope.
public AMI_View::getScope ( string $type, [ $aScope = array() ] ) returns array;
// 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 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;
}
Tags:
abstract
since 5.12.0

• Class Constants

TAB_STATE_ACTIVE

Tab state

TAB_STATE_COMMON

Tab state

TAB_STATE_DISABLED

Tab state

• Class Properies

protected array $aPlaceholders

Form default elements template (placeholders)

protected array $aPlaceholdersData

Placeholders custom data array.

protected string $viewType

View type

• Class Methods

// Returns section placeholders
public addField ( $aField, string $section ) returns array;
  • string $section

Implementation of: AMI_iModFormView::addField().

// Add new field into fields array.
public addSection ( string $name, string $position, [ string|array $displayByAction = NULL ] ) returns false|AMI_ModFormView;
  • string $name
    Section name.
  • string $position
    Section placeholder position.
  • string|array $displayByAction
    String/array to specify corresponding actions for tab to display (edit, new, etc...).
// Add a tab to the tab container. See AMI_ModFormView::addTabContainer() for usage example.
public addTab ( string $name, string $container, [ string $state = self::TAB_STATE_COMMON ], [ string $position = '' ], [ string $displayByAction = NULL ] ) returns AMI_ModFormView;
  • string $name
    Tab name
  • string $container
    Container name
  • string $state
    State of the tab: AMI_ModFormView::TAB_STATE_COMMON, AMI_ModFormView::TAB_STATE_ACTIVE or AMI_ModFormView::TAB_STATE_DISABLED
  • string $position
    Tab placeholder position, before|after locations are supported
  • string $displayByAction
    String/array to specify corresponding actions for tab to display (edit, new, etc...)
Tags:
since 5.12.4
// Add a tab container on the form.
public addTabContainer ( string $name, [ string $position = '' ] ) returns AMI_ModFormView;
  • string $name
    Name of the container
  • string $position
    Container placeholder position
  Example:
  •  // Somewhere in AMI_ModFormViewAdm child
  •  public function init(){
  •      parent::init();
  •  
  •      // ...
  •  
  •      // Add new tab container
  •      $this->addTabContainer('tabset1');
  •  
  •      // Add tabs
  •      $this->addTab('tab1''tabset1''active');
  •      $this->addTab('tab2''tabset1');
  •  
  •      // Add a field to the first tab
  •      $this->addField(array('name' => 'about''type' => 'htmleditor''cols' => 80'rows' => 10'position' => 'tab1.end'));
  •  
  •      // Add a field to the second tab
  •      $this->addField(array('name' => 'birth''type' => 'date''position' => 'tab2.end'));
  •  
  •      // ...
  •  
  •  }
Tags:
see AMI_ModFormView::addTab()
since 5.12.4
// Merges specified template with current one. New sets will be added, exisiting sets will be overwritten.
public addTemplate ( string $path, [ string $placeholderName = null ], [ $aLocale = null ] ) returns AMI_ModFormView;
  • string $path
    Template path
  • string $placeholderName
    Custom template for specific placeholder ( optional )
  • array $aLocale
    Section template locale
Tags:
since 5.12.4
// Drop field from fields array.
public dropField ( string $fieldName ) returns AMI_ModFormView;
  • string $fieldName
    Field name
// Drop the tab from the tab container.
public dropTab ( string $name, [ string $container = '' ] ) returns AMI_ModFormView;
  • string $name
    Tab name
  • string $container
    Container name
// Returns view data.
public get ( ) returns string;
// Allows change field at displaying form.
public getFieldHTML ( mixed $fieldName ) returns void;
// Set field data to render field.
public setFieldData ( string $name, mixed $data ) returns AMI_ModFormView;
  • string $name
    Field name
  • mixed $data
    Field data
Tags:
since 6.0.4
// Setting up model item object.