include/SugarFields/Parsers/SearchFormMetaParser.php
\SearchFormMetaParser
MetaParser.php
This is a utility base file to parse HTML
- Parent(s)
- \MetaParser
- Author
- Collin Lee
Properties
$mCustomPanels= ''
- Type
- n/a
- Inherited_from
- \MetaParser::$$mCustomPanels
$mModule= ''
- Type
- n/a
- Inherited_from
- \MetaParser::$$mModule
$mPHPFile= ''
- Type
- n/a
- Inherited_from
- \MetaParser::$$mPHPFile
$mView= ''
- Type
- n/a
- Inherited_from
- \MetaParser::$$mView
Methods
applyPostRules(
$moduleDir, $panels
)
:
void
Name | Type | Description |
---|---|---|
$moduleDir | ||
$panels |
applyPreRules(
$moduleDir, $panels
)
:
void
Name | Type | Description |
---|---|---|
$moduleDir | ||
$panels |
applyRules(
$moduleDir, $section
=
array()
)
:
void
Name | Type | Description |
---|---|---|
$moduleDir | ||
$section |
convertToTagElement(
$matches
)
:
void
Name | Type | Description |
---|---|---|
$matches |
createFileContents(
$moduleDir, $panels, $templateMeta
=
array(), $htmlFilePath
)
:
void
Name | Type | Description |
---|---|---|
$moduleDir | ||
$panels | ||
$templateMeta | ||
$htmlFilePath |
dirList(
\$directory $directory
)
:
\$results
dirList Utility method to list all the files in a given directory.
Inherited from: \MetaParser::dirList()Name | Type | Description |
---|---|---|
$directory | \$directory | The directory to scan |
Type | Description |
---|---|
\$results | The files in the directory that were found |
findAssignedVariableName(
\$name $name, \$filePath $filePath
)
:
\The
findAssignedVariableName This method provides additional support in attempting to parse the module's corresponding PHP file for either the EditView or DetailView. In the event that the subclasses cannot find a matching vardefs.php entry in the HTML file, this method can be called to parse the PHP file to see if the assignment was made using the bean's variable. If so, we return this variable name.
Inherited from: \MetaParser::findAssignedVariableName()Name | Type | Description |
---|---|---|
$name | \$name | The tag name found in the HTML file for which we want to search |
$filePath | \$filePath | The full file path for the HTML file |
Type | Description |
---|---|
\The | variable name found in PHP file, original $name variable if not found |
findSingleVardefElement(
$formElements
=
array(), $vardefs
=
array()
)
:
void
findSingleVardefElement Scans array of form elements to see if just one is a vardef element and, if so, return that vardef name
Inherited from: \MetaParser::findSingleVardefElement()Name | Type | Description |
---|---|---|
$formElements | ||
$vardefs |
fixDuplicateTrTags(
$tableContents
)
:
void
fixDuplicateTrTags This is a very crude function to fix instances where files have two consecutive
Name | Type | Description |
---|---|---|
$tableContents |
Name | Type | Description |
---|---|---|
$tableContents |
fixTablesWithMissingTr(
$tableContents
)
:
void
fixTablesWithMissingTr This is a very crude function to fix instances where files declared a table as
Name | Type | Description |
---|---|---|
$tableContents |
getCustomField(
\$elementNames $elementNames
)
:
String
isCustomField This method checks the mixed variable $elementNames to see if it is a custom field. A custom field is simply defined as a field that ends with "_c". If $elementNames is an Array any matching custom field value will result in a true evaluation
Inherited from: \MetaParser::getCustomField()Name | Type | Description |
---|---|---|
$elementNames | \$elementNames | Array or String value of form element name(s). |
Type | Description |
---|---|
String | name of custom field; null if none found |
getElementValue(
$type, $contents, $filter
=
"(.*?)"
)
:
void
Name | Type | Description |
---|---|---|
$type | ||
$contents | ||
$filter |
getElementsByType(
\$type $type, $contents
)
:
\a
Returns an Array of all elements matching type. It will match for the outermost tags. For example given contents: "
a |
a |
Name | Type | Description |
---|---|---|
$type | \$type | The type of element to parse out and return |
$contents |
Type | Description |
---|---|
\a | tag element format Array |
getFormContents(
$contents, $all
=
true
)
:
void
getFormContents Parses for contents enclosed within
tags Inherited from: \MetaParser::getFormContents()Name | Type | Description |
---|---|---|
$contents | ||
$all |
getFormElements(
\$contents $contents
)
:
\$matches
getFormElements Parses for input, select, textarea types from string content
Inherited from: \MetaParser::getFormElements()Name | Type | Description |
---|---|---|
$contents | \$contents | The String contents to parse |
Type | Description |
---|---|
\$matches | Array of matches of PREG_SET_ORDER |
getFormElementsNames(
\$contents $contents
)
:
\$matches
getFormElementsNames Parses for the name values of input, select, textarea types from string content
Inherited from: \MetaParser::getFormElementsNames()Name | Type | Description |
---|---|---|
$contents | \$contents | The String contents to parse |
Type | Description |
---|---|
\$matches | Array of name/value pairs |
getJavascript(
\$contents $contents, $addLiterals
=
true
)
:
\$javascript
This method parses the given $contents String and grabs all <script...>... blocks. The method also converts values enclosed within "{...}" blocks that may need to be converted to Smarty syntax.
Name | Type | Description |
---|---|---|
$contents | \$contents | The HTML String contents to parse |
$addLiterals |
Type | Description |
---|---|
\$javascript | The formatted script blocks or null if none found |
getMaxColumns(
\$contents $contents, \$filter $filter
)
:
\The
getMaxColumns Returns the highest number of
Name | Type | Description |
---|---|---|
$contents | \$contents | The table contents to parse |
$filter | \$filter | Optional filter to parse for an attribute within the td block. |
Type | Description |
---|---|
\The | maximum column count |
getRelateFieldName(
$mixed
=
''
)
:
void
Name | Type | Description |
---|---|---|
$mixed |
getTables(
\$tableClass $tableClass
=
null, $contents
)
:
Array
getTables Returns an Array of the tables found in the file. If $tableClass parameter is supplied, it'll return only those tables that have a matching class attribute equal to $tableClass
Inherited from: \MetaParser::getTables()Name | Type | Description |
---|---|---|
$tableClass | \$tableClass | Optional table class parameter value |
$contents |
Type | Description |
---|---|
Array | of table elements found |
getTagAttribute(
\$name $name, \$contents $contents, \$filter $filter
=
''
)
:
Array
getTagAttribute Returns the name/value of a tag attribute where name is set to $name
Inherited from: \MetaParser::getTagAttribute()Name | Type | Description |
---|---|---|
$name | \$name | The name of the attribute |
$contents | \$contents | The contents to parse |
$filter | \$filter | Option regular expression to filter value |
Type | Description |
---|---|
Array | of name/value for matching attribute |
hasMultiplePanels(
$panels
)
:
void
Name | Type | Description |
---|---|---|
$panels |
hasRequiredSpanLabel(
$html
)
:
void
Name | Type | Description |
---|---|---|
$html |
mergePanels(
\$panels $panels, \$moduleDir $vardefs, \$masterCopy $moduleDir, $masterCopy
)
:
Array
mergePanels This function merges the $panels Array against the $masterCopy's meta data definition
Inherited from: \MetaParser::mergePanels()Name | Type | Description |
---|---|---|
$panels | \$panels | meta data Array to merge |
$vardefs | \$moduleDir | Directory name of the module |
$moduleDir | \$masterCopy | file path to the meta data master copy |
$masterCopy |
Type | Description |
---|---|
Array | of merged $panel definition |
mergeSection(
$section, $masterSection
)
:
void
Name | Type | Description |
---|---|---|
$section | ||
$masterSection |
mergeTemplateMeta(
\$templateMeta $templateMeta, \$moduleDir $moduleDir, \$masterCopy $masterCopy
)
:
Array
mergeTemplateMeta This function merges the $templateMeta Array against the $masterCopy's meta data definition
Inherited from: \MetaParser::mergeTemplateMeta()Name | Type | Description |
---|---|---|
$templateMeta | \$templateMeta | meta data Array to merge |
$moduleDir | \$moduleDir | Directory name of the module |
$masterCopy | \$masterCopy | file path to the meta data master copy |
Type | Description |
---|---|
Array | of merged $templateMeta definition |
parse(
$filePath, $vardefs
=
array(), $moduleDir
=
'', $merge
=
false, $masterCopy
=
null
)
:
\$obj
parse
Name | Type | Description |
---|---|---|
$filePath | ||
$vardefs | ||
$moduleDir | ||
$merge | ||
$masterCopy |
Type | Description |
---|---|
\$obj | A MetaDataBean instance |
parseDelimiters(
$javascript
)
:
void
Name | Type | Description |
---|---|---|
$javascript |
processSection(
$section, $table, $filePath, $vardefs
=
array()
)
:
void
Name | Type | Description |
---|---|---|
$section | ||
$table | ||
$filePath | ||
$vardefs |
stripComments(
$contents
)
:
void
Name | Type | Description |
---|---|---|
$contents |
stripFlavorTags(
\$contents $contents
)
:
void
stripFlavorTags This method accepts the file contents and uses the $GLOBALS['sugar_flavor'] value to remove the flavor tags in the file contents if present. If $GLOBALS['sugar_flavor'] is not set, it defaults to PRO flavor
Inherited from: \MetaParser::stripFlavorTags()Name | Type | Description |
---|---|---|
$contents | \$contents | The file contents as a String value |
trimHTML(
$contents
)
:
void
Name | Type | Description |
---|---|---|
$contents |