@param array $row_data
@param string $field

@return string
12657
protected function replaceTemplateVars(array $row_data, string $field)
    {
        $pairs = [];

        foreach ($row_data as $k => $v) {
            if (!$this->isHtmlAllowed()) {
                $v = htmlspecialchars((string)$v, ENT_QUOTES);
            }
            $pairs['{%' . $k . '%}'] = $v;
        }

        if (strpos($field, '{%') !== false) {
            return strtr($field, $pairs);
        }

        return $field;
    }
320424
protected function renderDataCellContent($row, $data)
    {
        /* @var $am CAuthManager|AuthBehavior */
        $am = Yii::app()->getAuthManager();

        if ($am->hasParent($this->itemName, $data['name'])) {
            echo TbHtml::linkButton(
                TbHtml::icon(TbHtml::ICON_REMOVE),
                array(
                    'color' => TbHtml::BUTTON_COLOR_LINK,
                    'size' => TbHtml::BUTTON_SIZE_MINI,
                    'url' => array('removeParent', 'itemName' => $this->itemName, 'parentName' => $data['name']),
                    'rel' => 'tooltip',
                    'title' => Yii::t('AuthModule.main', 'Remove'),
                )
            );
        } else {
            if ($am->hasChild($this->itemName, $data['name'])) {
                echo TbHtml::linkButton(
                    TbHtml::icon(TbHtml::ICON_REMOVE),
                    array(
                        'color' => TbHtml::BUTTON_COLOR_LINK,
                        'size' => TbHtml::BUTTON_SIZE_MINI,
                        'url' => array('removeChild', 'itemName' => $this->itemName, 'childName' => $data['name']),
                        'rel' => 'tooltip',
                        'title' => Yii::t('AuthModule.main', 'Remove'),
                    )
                );
            }
        }
    }
147667
public function getDataAttributesHtml(array $row_data = []): string
    {
        if (!$row_data) {
            $row_data = [];
        }

        $html = [];

        foreach ($this->data_attributes as $k => $v) {
            $html[] = ' data-' . $k . '="' . $this->replaceTemplateVars($row_data, $v) . '"';
        }

        return implode(' ', $html);
    }
782783
public function row($container_link, $row_link, $options = []) {
		// if we have a lock we do not add elements
		if (!empty($this->misc_settings['acl_subresource_locks'][$container_link]['remove'])) {
			return;
		}
		// process acl_subresource
		if (!empty($options['acl_subresource_remove']) && !$this->tempProcessACLSubresources($options['acl_subresource_remove'], 'Record_View')) {
			$this->misc_settings['acl_subresource_locks'][$container_link . '::' . $row_link]['remove'] = true;
			return;
		}
		// process acl_subresource_hide
		if (!empty($options['acl_subresource_hide']) && !$this->tempProcessACLSubresources($options['acl_subresource_hide'], 'Record_View')) {
			$options['hidden'] = true;
		}
		$this->container($container_link, array_key_extract_by_prefix($options, 'container_'));
		if (!isset($this->data[$container_link]['rows'][$row_link])) {
			// hidden rows
			if ($row_link == $this::HIDDEN) {
				$options['order'] = 35000;
			}
			// validating row type
			$types = \Object\HTML\Form\Row\Types::getStatic();
			if (!isset($options['type']) || !isset($types[$options['type']])) {
				$options['type'] = $this->data[$container_link]['default_row_type'] ?? 'grid';
			}
			$options['container_link'] = $container_link;
			$options['row_link'] = $row_link;
			// setting values
			$this->data[$container_link]['rows'][$row_link] = [
				'type' => $options['type'],
				'elements' => [],
				'options' => $options,
				'order' => $options['order'] ?? 0
			];
			// handling widgets
			if (($this->data[$container_link]['type'] ?? '') == 'tabs' && !empty($options['widget'])) {
				$options['type'] = 'tabs';
				// we skip if widgets are not enabled
				$temp = \Object\ACL\Resources::getStatic('widgets', $options['widget']);
				if (empty($temp) || empty($this->collection_object->primary_model->{$options['widget']}) || !$this->processWidget($options)) {
					unset($this->data[$container_link]['rows'][$row_link]);
					return;
				}
			}
		} else {
			$this->data[$container_link]['rows'][$row_link]['options'] = array_merge_hard($this->data[$container_link]['rows'][$row_link]['options'], $options);
			if (isset($options['order'])) {
				$this->data[$container_link]['rows'][$row_link]['order'] = $options['order'];
			}
		}
	}
435590
public function getFieldValues(string $field_name)
    {
        try {
            $field = [];
            $result = $this->stmt->fetchAll(\PDO::FETCH_ASSOC);
            if (array_key_exists($field_name, $result[0])) {
                foreach ($result as $row) {
                    $field[] = $row[$field_name];
                }
            } else {
                throw new \Exception("Field '$field_name' is not present in the current result set.\n");
            }
            return $field;
        } catch (\PDOException $e) {
            die('Error: ' . $e->getMessage());
        } catch (\Exception $e) {
            die("Error: " . $e->getMessage());
        }
    }
100885
public function farray_fieldnames($index=null) {
		$retval = null;
		if(is_object($this->sth)) {
			$oData = $this->sth->fetchAll(\PDO::FETCH_ASSOC);
			
			$retval = array();
			
			if($this->numRows > 0) {
				$retval = $oData;
				
				if(!is_null($index)) {
					$newData = array();
					foreach($oData as $rowData) {
						if(isset($rowData[$index])) {
							if(!isset($newData[$rowData[$index]])) {
								$newData[$rowData[$index]] = $rowData;
							}
							else {
								// TODO: maybe this should be a warning (or *can* be, based on a configuration directive).
								throw new \Exception(__METHOD__ .': duplicate records exist for index=('. $index .'), first duplicate was ('. $rowData[$index] .')');
							}
						}
						else {
							throw new \Exception(__METHOD__ .": record does not contain column '". $index ."'");
						}
					}
					$retval = $newData;
				}
			}
			else {
				// no rows!
				$retval = array();
			}
		}
		else {
			throw new \Exception(__METHOD__ .': statement handle was not created');
		}
		return($retval);
	}
706840
public function renderRowDefinition(PHPRtfLite_Table_Row $row)
    {
        $rowIndex = $row->getRowIndex();
        $stream = $this->getRtf()->getWriter();
        $stream->write('\trowd');

        if ($this->_alignment) {
            switch ($this->_alignment) {
                case self::ALIGN_CENTER:
                    $stream->write('\trqc');
                    break;

                case self::ALIGN_RIGHT:
                    $stream->write('\trqr');
                    break;

                default:
                    $stream->write('\trql');
                    break;
            }
        }

        $rowHeight = $row->getHeight();
        if ($rowHeight) {
            $stream->write('\trrh' . PHPRtfLite_Unit::getUnitInTwips($rowHeight));
        }

        if ($this->isPreventPageBreak()) {
            $stream->write('\trkeep ');
        }

        if ($this->isFirstRowHeader() && $rowIndex == 1) {
            $stream->write('\trhdr ');
        }

        if ($this->getLeftPosition() != '') {
            $stream->write('\trleft' . PHPRtfLite_Unit::getUnitInTwips($this->getLeftPosition()) . ' ');
        }

        $width = 0;
        foreach ($this->getColumns() as $columnIndex => $column) {
            $cell = $this->getCell($rowIndex, $columnIndex + 1);

            // render cell definition
            if (!$cell->isHorizontalMerged()) {
                $cell->renderDefinition();

                // cell width
                $width += PHPRtfLite_Unit::getUnitInTwips($cell->getWidth());
                $stream->write('\cellx' . $width);
            }
        }
    }
458341
public function quoteFields(array $row): string
    {
        $fields = [];
        foreach (array_keys($row) as $field) {
            $fields[] = $this->quoteName($field);
        }

        return implode(', ', $fields);
    }
175035
private function getFileIdsByField(array $data, string $field) : array
    {
        $result = Hash::extract($data, sprintf('%s.%s_ids', $this->table->getAlias(), $field));
        $result = empty($result) ? Hash::extract($data, sprintf('%s_ids', $field)) : $result;
        $result = array_filter((array)$result);

        return $result;
    }
461312
public static function filterStripDbRowData(array $rowData, $dbTableAlias, $skipStrip = false)
    {
        $columnPrefix = $dbTableAlias . '_';

        $filteredAndStrippedRowData = [];
        foreach ($rowData as $key => $val) {
            if (strpos($key, $columnPrefix) === 0) {
                $strippedKey = $skipStrip ? $key : Str::stripLeft($key, $columnPrefix);
                $filteredAndStrippedRowData[$strippedKey] = $val;
            }
        }

        return $filteredAndStrippedRowData;
    }
85547
public function getRowStyle(array $row_data): string
    {
        if ($this->ajax || (isset($row_data[$this->pid_column]) && (string)$row_data[$this->pid_column] === $this->_top_level_id)) {
            return '';
        }

        return 'display: none;';
    }
697452
public function getCellView($cell_data, array $row_data = [])
    {
        if ($this->tooltip_field && $row_data) {
            $this->requireTooltipJavascript();
            $tooltip = $this->replaceTemplateVars($row_data, $this->tooltip_field);

            if ($tooltip) {
                return '<td' . $this->getAttributesView(0, $row_data) . ' tooltip="' . nl2br(htmlspecialchars($tooltip, ENT_QUOTES)) . '" onmouseover="cmsTooltip.show(this,' . $this->tooltip_field_colspan . ')" onmouseout="cmsTooltip.hide(this)">' . $cell_data . '</td>';
            }
        }

        // Order for drag-and-drop
        if ($this instanceof ColumnOrder && isset($row_data['order']) && $this->isDragable()) {
            $this->addDataAttribute('order', $row_data['order']);
        }

        // Cut long strings
        if ($this->cut_long_strings && $cell_data === strip_tags((string)$cell_data)) {
            $cell_data = Converter::cutLongStrings((string)$cell_data, $this->cut_long_strings_limit);
        }

        return '<td' . $this->getAttributesView(false, $row_data) . '>' . $cell_data . '</td>';
    }
718667
function insertRow($row, $row_id = 0) {
        array_splice($this->_data, $row_id, 0, array($row));

        $this->_updateRowsCols($row);
    }
1357842
public static function finagleVarcharFieldTypeForIndexListing($field, $data) {
   	if (empty($field['persist_wash'])) {
            return $data;
        }
    
        if (strtolower($field['persist_wash']) == "url") {
            $prefacedURL = self::prefaceURLwithHTTP($data);
            return '<a href="'.$prefacedURL.'" target="_blank">'.$data.'</a>';
        }

        return $data;
    }
981521
def parse_row(line_num, line, header, column_idx, prev_fields, options)
      fields = LineParser::parse(line, options[:in_format], options[:split_on])
      return nil,nil if fields.compact == []
      if options[:pad_fields] and fields.size < header.size
        fields += [''] * (header.size - fields.size) 
      end
      fields = Formatter::strip_quotes(fields) if @strip_quotes
      fields = Formatter::transform_row_ids(@transform_ids, fields) if @transform_ids
      fields = Filter::apply_column_filter(fields,column_idx) 
      return nil,nil if fields.compact == []
      rowname = fields[0]
      data_fields = fields[@first_column..-1]
      if data_fields.size > 0
        return nil,nil if not Validator::valid_row?(line_num, data_fields, prev_fields)
        return nil,nil if not Filter::numeric(@num_filter,data_fields,header)
        return nil,nil if not Filter::generic(@filter,data_fields,header)
        (rowname, data_fields) = Rewrite::rewrite(@rewrite,rowname,data_fields)
      end
      return rowname, data_fields
    end
104466
private function processWithKey(array $rows, $keyField)
    {
        if (empty($rows)) {
            return [];
        }

        $first = reset($rows);

        if (!isset($first->$keyField)) {
            throw new FieldNotFoundException($keyField . ' field not found in result of the query');
        }

        $result = [];
        foreach ($rows as $row) {
            $result[$row->$keyField] = $row;
        }

        return $result;
    }
731560
public function getView(int $row, array $row_data, Linker $linker): string
    {
        $linker_array = ['do' => '_accept', 'id' => $row_data['id']];
        $value = $this->getCellData($row_data);

        $cell_data = '<form action="' . $this->getParsedHref($row_data, $linker, $linker_array) . '" method="post"><input onclick="this.form.submit();" type="checkbox"' . ($value ? ' checked="checked" disabled="disabled"' : '') . ' name="input" value="1"></form>';

        return $this->getCellView($cell_data, $row_data);
    }