Ejemplo n.º 1
0
 /**
  * Add new field to search engine.
  *
  * @access   public
  * @param    string $sName
  * @param    string $sType
  * @return   Form\Field
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function addField($sName, $sType)
 {
     // create form field for search engine
     $oField = $this->getForm()->add($sName, $sType)->setViewBase($this->getFormFieldView());
     /* @var $oField Form\Field */
     // default path to view for search engine field
     $sSearchEngineViewPath = 'base/form/searchengine/field/' . $sType;
     // checking if for particular field type, searchengine view exists
     if (View::viewExists($sSearchEngineViewPath)) {
         $oField->setView($sSearchEngineViewPath);
     }
     // return
     return $oField;
 }
Ejemplo n.º 2
0
 /**
  * Get field View.
  *
  * @access   public
  * @return   View
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function getView()
 {
     $sFieldViewPath = $this->getEntity()->getViewFieldPath();
     $sFieldViewPath1 = $sFieldViewPath . '__' . $this->getEntity()->getHtmlClass();
     $sFieldViewPath2 = $sFieldViewPath1 . '__' . $this->getTypeOfModel();
     $sFieldViewPath3 = $sFieldViewPath1 . '__' . $this->getName();
     if (View::viewExists($sFieldViewPath1)) {
         $sFinalPath = $sFieldViewPath1;
     } elseif (View::viewExists($sFieldViewPath2)) {
         $sFinalPath = $sFieldViewPath2;
     } elseif (View::viewExists($sFieldViewPath3)) {
         $sFinalPath = $sFieldViewPath3;
     } else {
         $sFinalPath = $sFieldViewPath;
     }
     return View::factory($sFinalPath)->bind('oField', $this)->bind('sPrefix', $this->sPrefix)->bind('sSuffix', $this->sSuffix);
 }
Ejemplo n.º 3
0
 /**
  * Prepare list of entities for \Plethora\View.
  *
  * @access     private
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 private function prepare()
 {
     // get html class
     $sChangedClass = str_replace(['\\', 'Model_'], ['_', ''], $this->getModelClassName());
     $this->sHtmlClass = strtolower($sChangedClass);
     // set path to View to single row for particular Model
     $sViewSingleRowByClass = $this->sViewPathSingleRowDefault . '__' . $this->sHtmlClass;
     if (View::viewExists($sViewSingleRowByClass)) {
         $this->sViewPathSingleRow = $sViewSingleRowByClass;
     }
     // set path to View for the whole list
     $sViewListByClass = $this->sViewPathListDefault . '__' . $this->sHtmlClass;
     if (View::viewExists($sViewListByClass)) {
         $this->sViewPathList = $sViewListByClass;
     }
     // prepare entities
     foreach ($this->getConfigurator()->getList() as $oEntityFromModel) {
         /* @var $oEntityFromModel \Plethora\ModelCore */
         $oConfigurator = ViewEntity\Configurator::factory($oEntityFromModel)->setFields($this->getConfigurator()->getFields())->setMaxLevel($this->getConfigurator()->getMaxLevel())->setCurrentLevel($this->getConfigurator()->getCurrentLevel())->setProfile($this->getConfigurator()->getProfile())->setViewListReference($this);
         $oViewEntity = ViewEntity::factory($oConfigurator);
         $oViewEntity->setViewFieldPath($this->getViewPathField());
         $this->aListPrepared[] = $oViewEntity;
     }
 }