Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Schwirjow authored and Alexander Schwirjow committed Sep 19, 2018
1 parent efb340f commit a01e8a2
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 7 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@

#### 0.7.1

- FIX: minor typo and code quality fixes
- FIX: minor typo and code quality fixes

#### 0.7.3

- FIX: minor translation fixes
- ADD: More comments in code
6 changes: 3 additions & 3 deletions src/Resources/contao/classes/FontFaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function generatePageHook(PageModel $page, LayoutModel $layout, PageRegul
* Fetch the name of the font by its id
*
* @param int $fontId
* @return String
* @return string
*/
public function getFontFaceName($fontId)
{
Expand All @@ -191,8 +191,8 @@ public function getFontFaceName($fontId)
/**
* Generate unique font path
*
* @param Strign $fontName
* @return String
* @param string $fontName
* @return string
*/
public function generateFilePath($fontName)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/dca/tl_fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public function __construct()
}

/**
* COmbine all font properties into a label
* Combine all font properties into a label
*
* @param array $row
* @param string $label
Expand Down
44 changes: 42 additions & 2 deletions src/Resources/contao/dca/tl_fonts_faces.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ public function __construct()
$this->import('BackendUser', 'User');
}

/**
* Handle the import action if action has been called via GET parameter
*
* @param DataContainer $dc
* @return string
*/
public function switchAction($dc)
{
if (\Input::get('key') && \Input::get('key') === 'export') {
Expand Down Expand Up @@ -178,11 +184,28 @@ public function checkPermission()
}
}

/**
* Return HTML-formated name of the font
*
* @param array $row
* @return string
*/
public function listFontVariants($row)
{
return '<div class="tl_content_left">'.$row['name']."</div>\n";
}

/**
* Generates an edit icon if the backend user is allowed to edit
*
* @param array $row
* @param string $href
* @param string $label
* @param string $title
* @param string $icon
* @param string $attributes
* @return string
*/
public function editHeader($row, $href, $label, $title, $icon, $attributes)
{
return $this->User->canEditFieldsOf('tl_fonts_faces') ? '<a href="'.$this->addToUrl($href.'&amp;id='.$row['id']).'" title="'.StringUtil::specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon, $label).'</a> ' : Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)).' ';
Expand All @@ -208,9 +231,26 @@ public function exportCSS()
$objFile->close();
}

public function exportButtonCallback($arrRow, $href, $label, $title, $icon, $attributes, $strTable, $arrRootIds, $arrChildRecordIds, $blnCircularReference, $strPrevious, $strNext)
/**
* Append custom button to the header to allow import
*
* @param array $row
* @param string $href
* @param string $label
* @param string $title
* @param string $icon
* @param array $attributes
* @param string $strTable
* @param array $arrRootIds
* @param array $arrChildRecordIds
* @param boolean $blnCircularReference
* @param string $strPrevious
* @param string $strNext
* @return string
*/
public function exportButtonCallback($row, $href, $label, $title, $icon, $attributes, $strTable, $arrRootIds, $arrChildRecordIds, $blnCircularReference, $strPrevious, $strNext)
{
$href .= sprintf("&id=%s", $arrRow['id']);
$href .= sprintf("&id=%s", $row['id']);

return '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'"'.$attributes.'>'.\Image::getHtml($icon, $label).'</a> ';
}
Expand Down

0 comments on commit a01e8a2

Please sign in to comment.