Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ability to replace form label with some element data #2208

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ COM_FABRIK_FIELD_TIPS_OVER_ELEMENT_DESC="If no selected then the tip only appear
COM_FABRIK_FIELD_TIPS_OVER_ELEMENT_LABEL="Tips over element"
COM_FABRIK_FIELD_TITLE_DESC="The text that appears in the form, at the start of the group"
COM_FABRIK_FIELD_TITLE_LABEL="Label"
COM_FABRIK_FIELD_USE_AS_DETAILS_LABEL_DESC="When displaying readonly replace form label with this element data. When using data from multiple elements, a | separator is used"
COM_FABRIK_FIELD_USE_AS_DETAILS_LABEL_LABEL="Use as details 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 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."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,8 @@ COM_FABRIK_FIELD_TIPS_OVER_ELEMENT_DESC="'Ei' korral ilmub abiteave ainult sildi
COM_FABRIK_FIELD_TIPS_OVER_ELEMENT_LABEL="Näita abiteavet elemendi ees"
COM_FABRIK_FIELD_TITLE_DESC="Tekst mida näidatakse vormil grupi pealkirjana"
COM_FABRIK_FIELD_TITLE_LABEL="Silt"
COM_FABRIK_FIELD_USE_AS_DETAILS_LABEL_DESC="Üksikasjade vaates asenda vormi pealkiri selle elemendi andmetega. Mitme elemendi andmete kuvamisel vormi pealkirja asemel eraldatakse andmed | joonega"
COM_FABRIK_FIELD_USE_AS_DETAILS_LABEL_LABEL="Kasuta üksikasjade pealkirjana"
COM_FABRIK_FIELD_USER_DESC="Andmebaasi kasutaja ühenduse loomiseks"
COM_FABRIK_FIELD_USER_LABEL="Kasutaja"
; 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."
Expand Down
13 changes: 13 additions & 0 deletions administrator/components/com_fabrik/models/forms/element.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@
<option value="1">JYES</option>
</field>

<fields name="params">
<fieldset name="publishing2">
<field name="use_as_details_label"
type="radio"
class="btn-group"
default="0"
description="COM_FABRIK_FIELD_USE_AS_DETAILS_LABEL_DESC"
label="COM_FABRIK_FIELD_USE_AS_DETAILS_LABEL_LABEL" >
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
</fields>
</fieldset>

<fieldset name="access">
Expand Down
24 changes: 24 additions & 0 deletions components/com_fabrik/models/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -4304,6 +4304,30 @@ public function getLabel()

if (!$this->isEditable())
{
$titles = [];

$groups = $this->getGroupsHiarachy();

foreach ($groups as $groupModel)
{
$elementModels = $groupModel->getPublishedElements();

foreach ($elementModels as $elementModel)
{
$element = $elementModel->getParams();

if ($element->get('use_as_details_label') == '1')
{
$titles[] = $elementModel->getTitlePart($this->data);
}
}
}

if (count($titles) > 0)
{
$label = implode(' | ', $titles);
}

return str_replace("{Add/Edit}", '', $label);
}

Expand Down