Skip to content

Commit

Permalink
Tweaking "Use as row class" code to check if the value starts with a
Browse files Browse the repository at this point in the history
number, rather than is entirely numeric.  If so, prepends element
(short) name to class name.
  • Loading branch information
cheesegrits committed Oct 6, 2015
1 parent b9a0890 commit b2c89f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Expand Up @@ -682,7 +682,7 @@ COM_FABRIK_FIELD_TITLE_DESC="The text that appears in the form, at the start of
COM_FABRIK_FIELD_TITLE_LABEL="Label"
COM_FABRIK_FIELD_USER_DESC="The database user name to use to connect to the view"
COM_FABRIK_FIELD_USER_LABEL="User"
COM_FABRIK_FIELD_USE_AS_ROW_CLASS_DESC="If set to 'row' then each of the list view's rows will have this elements value added as an additional class name. This allows you to format rows based on the view's data."
COM_FABRIK_FIELD_USE_AS_ROW_CLASS_DESC="If Yes then each of the list view's rows will have this elements value added as an additional class name. This allows you to format rows based on the view's data. As CSS classes cannot start with a number, if your data starts with a number, we will prepend the element (short) name to the class name, like myelement3 instead of just 3."
COM_FABRIK_FIELD_USE_AS_ROW_CLASS_LABEL="Use as row class"
COM_FABRIK_FIELD_VIEW_CSS_CELL_CLASS_DESC="Specify a class name to apply to this elements table column cells (does not include the heading element) e.g. 'myCell'"
COM_FABRIK_FIELD_VIEW_CSS_CELL_CLASS_LABEL="Cell class"
Expand Down
3 changes: 2 additions & 1 deletion components/com_fabrik/models/element.php
Expand Up @@ -6984,7 +6984,8 @@ public function setRowClass(&$data)
$c = FabrikString::rtrim($c, '-');

// $$$ rob 24/02/2011 can't have numeric class names so prefix with element name
if (is_numeric($c))
// $$$ hugh can't have class names which start with a number, so need preg_match, not is_numeric()
if (preg_match('^\d', $c))
{
$c = $this->getElement()->name . $c;
}
Expand Down

0 comments on commit b2c89f3

Please sign in to comment.