Beispiel #1
0
 public function testCallsContactStudioViews()
 {
     $seed = new Call();
     $def = $seed->field_defs['contact_name'];
     $this->assertTrue(ListLayoutMetaDataParser::isValidField($def['name'], $def));
     $this->assertFalse(GridLayoutMetaDataParser::validField($def, 'editview'));
     $this->assertFalse(GridLayoutMetaDataParser::validField($def, 'detailview'));
     $this->assertFalse(GridLayoutMetaDataParser::validField($def, 'quickcreate'));
 }
 function getAvailableFields()
 {
     // Obtain the full list of valid fields in this module
     $availableFields = array();
     foreach ($this->_fielddefs as $key => $def) {
         if (GridLayoutMetaDataParser::validField($def, $this->_view) || isset($this->_originalViewDef[$key])) {
             //If the field original label existing, we should use the original label instead the label in its fielddefs.
             if (isset($this->_originalViewDef[$key]) && is_array($this->_originalViewDef[$key]) && isset($this->_originalViewDef[$key]['label'])) {
                 $availableFields[$key] = array('name' => $key, 'label' => $this->_originalViewDef[$key]['label']);
             } else {
                 $availableFields[$key] = array('name' => $key, 'label' => isset($def['label']) ? $def['label'] : $def['vname']);
                 // layouts use 'label' not 'vname' for the label entry
             }
         }
     }
     // Available fields are those that are in the Model and the original layout definition, but not already shown in the View
     // So, because the formats of the two are different we brute force loop through View and unset the fields we find in a copy of Model
     if (!empty($this->_viewdefs)) {
         foreach ($this->_viewdefs['panels'] as $panel) {
             foreach ($panel as $row) {
                 foreach ($row as $field) {
                     unset($availableFields[$field]);
                 }
             }
         }
     }
     return $availableFields;
 }
 /**
  * Utility method that allows delegation of validation to child objects
  *
  * @param stirng $key The name of the field to check - used by child validators
  * @param array $def The field defs
  * @return bool
  */
 protected function isValidField($key, array $def)
 {
     return GridLayoutMetaDataParser::validField($def, $this->_view, $this->client);
 }