Code Monkey home page Code Monkey logo

selectbox_link_field's Introduction

Select Box Link Field

Installation

  1. Upload the selectbox_link_field folder in this archive to your Symphony 'extensions' folder.
  2. Enable it by selecting the "Field: Select Box Link", choose Enable from the with-selected menu, then click Apply.
  3. You can now add the "Select Box Link" field to your sections.

Updating

  1. Be sure to visit the Extension page in the Symphony admin and enable "Select Box Link Field" so the database is updated accordingly.

Usage

  • Works in a near identical way to the standard select box field, however there is no static options and entries are linked internally via their ID, meaning that if an entry is changed, any Select Box Link fields will not lose their link to that entry. The data on the front-end is presented in a way identical to that of a Section Link.

  • Setting an instance of the field to be not required will cause an empty option to show up on the publish form.

Filtering options

The Select Box Link supports the following filtering options in your data sources:

  • Red Cats or not: Red Cats: Return all entries where the linked entry has the value of Red Cats (or does not have the value Red Cats)
  • red-cats or not: red-cats: Return all entries where the linked entry has the handle of red-cats (or does not have the handle red-cats)
  • 1 or not: 1: Return all entries where the linked entry ID is 1, (or is not 1)
  • sql-null-or-not: 1: Return all entries where the linked entry ID is not 1 or the entry has no linked entries.
  • sql: NULL: Return all entries that do not have any linked entries
  • sql: NOT NULL: Return all entries that have a linked entry

Please note that predicate filters, such as not: or sql:, will ignore all other data source filters for that field.

Sorting

The sorting is activated only if ALL related field are sortable.

Right now, to be sortable, the related field must have a value column in the entries data.

selectbox_link_field's People

Contributors

alexbirukov avatar andrewminton avatar brendo avatar bzerangue avatar cd-jenkins-bot avatar cz avatar designermonkey avatar idea07 avatar kanduvisla avatar lnikkila avatar makenosound avatar michael-e avatar nickdunn avatar nilshoerrmann avatar nitriques avatar rainerborene avatar simoneeconomo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

selectbox_link_field's Issues

Limit should by 0 by default

"most recent entries" should allow 0 and should be 0 by default. This has screwed up my projects multiple times, I'd really like it to not limit, as its arbitrary and insignificant. Its nice to have if needed, but I really loathe its default functionality.

Missing "No entries found" message

When no entries exist in the linked section, only the section name is shown in the field - which looks kind of strange and confusing (especially as I often reuse the section name as the select box link field's name as well).

How about displaying "There are currently no items available." or "No entries found."?

SLB with no existing entries

Invisible mode

With pull request symphony-2/#1734 it will be possible to create new nested entries from the association drawer directly (using filtered and prepopulated links). It would be nice, if this extension offered an "invisible mode" which simply visually hides the field from the section. This would help make it a replacement for Subsection Manager.

Sort order on index page is broken when SBL is the first visible field

The current version of the SBL Field sorts items in select boxes by date only (see #20).

Nevertheless, on the entry index page, if an SBL field's values reside in the first column (i.e. the SBL field is the first field in the section), all entries are sorted alphabetically if the sortorder is not set.

So even after applying ?unsort to such an index table (with the first field being an SBL field) you will only see alphabetical sorting. I would expect the entries to be sorted by date then (to be precise: in the same order as in the SBL select box occuring in other sections).

File uploads

Using file uploads as values results in markup being shown as select options:
instead of default.jpg SBL will show <a href="http://webseiten/pompodium2/workspace/media/default.jpg" data-path="/workspace/media">default.jpg</a>.

Prepopulating no longer working with latest 2.7.x Symphony branch

There was a change recently that meant prepopulating values in Select Box Link fields isn't working. You can see the issue at symphonycms/symphonycms#2751

The problem is SBL field is missing a canPrePopulate() method. It appears that it should have had one, but worked due to a missing check in the __viewNew method of contentPublish class.

The solution is to simply add the following to the SBL field (since the parent object returnsfalse):

    public function canPrePopulate() {
        return true;
    }

Doesn't appear to be any side effects to this addition since the field has always been able to prepopulate.

I will make a pull request for this change shortly.

Filter linked section values

is it possible for a future release to filter results that are going to appear in the select box value, by a certain field in the linked section?

i attached an example, where Articles entries category can only be "Electronics"; since is filtered by it's status in linked section Categories

thank you
sbl_prop

prepareImportValue is wrong

I've been pulling my hair out for an entire day as to why I can't import multiple values into a Select Box Link via the XML Importer.

I remember having the discussion with @brendo on the forum (http://www.getsymphony.com/discuss/thread/45612/) as to how to do it, and yet it still just wouldn't work. Single values always worked, but never multiple values.

Take this

<items>
    <item>42</item>
    <item>handle</item>
    <item>String</item>
</items>

Using an expression of ./items/item should allow a developer to add these values to a multiple Select Box Link, yet it fails every time. It always concatenates the values into a string.

I never even thought that it was the SBL itself that was doing the dirty here, as it's not changed with this regard for sooo long, but I was wrong.

No matter what you pass the SBL's prepareImportValue function, using the getValue style, it always returns a flat string, even though the field itself is more than capable of ingesting an array.

I've hacked a change to it as follows.

    public function prepareImportValue($data, $mode, $entry_id = null)
    {
        $message = $status = null;
        $modes = (object) $this->getImportModes();

        if (!is_array($data)) {
            $data = array($data);
        }

        if ($mode === $modes->getValue) {
            if ($this->get('allow_multiple_selection') === 'no') {
                return implode('', $data);
            }

            return $data; // <-- I have changed this little line
        } elseif ($mode === $modes->getPostdata) {
            // Iterate over $data, and where the value is not an ID,
            // do a lookup for it!
            foreach ($data as $key => &$value) {
                if (!is_numeric($value) && !is_null($value)) {
                    $value = $this->fetchIDfromValue($value);
                }
            }

            return $this->processRawFieldData($data, $status, $message, true, $entry_id);
        }

        return null;
    }

Instead of (as it currently is) implode($data) being where I have changed it (as commented), I let it return an array!

Now the XML Importer finally works as expected. That's three years of me having to find hacks and convoluted methods of associating import data. One line.

@brendo can you clarify this change and let me know if it will break anything else? @nitriques could you test it too for me before I PR this change, I want to make sure that I don't break anything.

Also, this will need replicating into the Association Field if all is good.

Load entries on Publish page asynchronously

Just a note for discussion as to whether the SBL is capable of being adapted to accommodate large data-sets from another section. The asynchronous part has been done for the section editor and I just wanted to raise this conversation for future development work.

Publish Filtering

This extension needs to be updated to make use of the new publish filtering options:

  • declare all filterable operators
  • specify suggestion type, association in this case

The latter will fix symphonycms/symphonycms#2073.

2.4 Error when Values set to None

I was adding an SBL to a section, but hadn't set up the section I was linking it to yet, so I set the Values field to None. However on saving the section I got the following error:

Symphony Fatal Database Error: Column 'related_field_id' cannot be null

Upcoming Sym2.4 issue

The SBL under Symphony 2.4 betas isn't outputting anything via a datasource.

Also, using the SBL in a filter in a DS has no effect whatsoever.

Could not find field..php in path

Symphony Fatal Error: Could not find Field at /field..php. If it was provided by an Extension, ensure that it is installed, and enabled.

Upon attempting to include SBL master or integration into a 2.4 integration build locally I get this error.

Looks like it can't find the field driver??

Options for SBL disabled on section load

I can't currently select any options when using integration branch of SBL. All options are currently disabled in the section editor??

Feels like a javascript issue in the main Symphony JS file.

The master branch does not currently function with Symphony 2.4 integration.

When field is not required, no value is set, and datasource is grouped by the field, the first entry gets picked

Let me explain:

  • I create a select box link field
  • Select single value
  • Set an associated section
  • Not required
  • My datasource groups the entries by this fields' value

Now, when no value is set (because the field is not required), the node gets created in the output, but the value and handle of the entry with the lowest ID are used.

For example, I've got a field called 'type':

<datasource>
    <type link-id="" link-handle="my-value" value="My Value">
        <entry>
            ...

The entry 'My Value' is the entry with the lowest id in the associated section.

While a workaround for this is checking on link-id, perhaps link-handle and value should be omitted in this result. Or are there better suggestions?

Symphony 2.4dev

Due to the clean-up in the symphony-2/integration-2.4 branch, this field does not work for me anymore. I'm not able to save a section containing a SBL field:

Symphony Fatal Error: Could not find Field at /field..php. If it was provided by an Extension, ensure that it is installed, and enabled.
An error occurred in /Users/nilshoerrmann/sites/symphony/symphony-2/symphony/lib/toolkit/class.fieldmanager.php around line 524

519             if(!isset(self::$_pool[$type])){
520                 $classname = self::__getClassName($type);
521                 $path = self::__getDriverPath($type);
522
523                 if(!file_exists($path)){
524                     throw new Exception(
525                         __('Could not find Field %1$s at %2$s.', array('<code>' . $type . '</code>', '<code>' . $path . '</code>'))
526                         . ' ' . __('If it was provided by an Extension, ensure that it is installed, and enabled.')
527                     );
528                 }

Backtrace

[/Users/nilshoerrmann/sites/symphony/symphony-2/symphony/content/content.blueprintssections.php:649]
    FieldManager::create();
[/Users/nilshoerrmann/sites/symphony/symphony-2/symphony/content/content.blueprintssections.php:857]
    contentBlueprintsSections->__actionNew();
[/Users/nilshoerrmann/sites/symphony/symphony-2/symphony/lib/toolkit/class.administrationpage.php:613]
    contentBlueprintsSections->__actionEdit();
[/Users/nilshoerrmann/sites/symphony/symphony-2/symphony/lib/toolkit/class.administrationpage.php:582]
    AdministrationPage->__switchboard();
[/Users/nilshoerrmann/sites/symphony/symphony-2/symphony/lib/toolkit/class.administrationpage.php:392]
    AdministrationPage->action();
[/Users/nilshoerrmann/sites/symphony/symphony-2/symphony/lib/core/class.administration.php:255]
    AdministrationPage->build();
[/Users/nilshoerrmann/sites/symphony/symphony-2/symphony/lib/core/class.administration.php:453]
    Administration->__buildPage();
[/Users/nilshoerrmann/sites/symphony/symphony-2/index.php:22]
    Administration->display();

Notice the field name field..php.

Filtering when "allow_multiple_selection" enabled

LEFT JOIN causes wrong entries count ( it is obvious, when you join one-to-many table)

I fixed this problem using "SELECT DISTINCT" in entry manager, even their is no grouping

SELECT count(".($group ? 'DISTINCT ' : 'DISTINCT')."e.id) as count

Different handle lengths with (selectbox-)linked sections

I have a section called termine, and a comments-section called kommentare. The comments are linking to the first section. All well, except when I output the comments, they show a shorter handle than the original section they are linked to. Here’s an example:

An entry in the termine-section:

<entry id="167">
            <titel handle="zeiten-der-form-formen-der-zeit-erste-jahrestagung-des-dfg-schwerpunktprogramms-1688">Zeiten der Form, Formen der Zeit. Erste Jahrestagung des DFG-Schwerpunktprogramms 1688</titel>
<…>
</entry>

How it shows up linked in the comment:

<entry id="182" section-handle="kommentare">
        <…>
        <termin>
            <item id="167" handle="zeiten-der-form-formen-der-zeit-erste-jahrestagung-des-dfg-schwerpunktpro" section-handle="termine" section-name="Termine">Zeiten der Form, Formen der Zeit. Erste Jahrestagung des DFG-Schwerpunktpro…</item>
        </termin>
<…>
</entry>

zeiten-der-form-formen-der-zeit-erste-jahrestagung-des-dfg-schwerpunktprogramms-1688 vs. zeiten-der-form-formen-der-zeit-erste-jahrestagung-des-dfg-schwerpunktpro

The truncation seems to be at the same length as the title in the Entry Editor. (<h2>Zeiten der Form, Formen der Zeit. Erste Jahrestagung des DFG-Schwerpunktpro…</h2>)

As you can see the item/@handle is truncated, while the title/@handle in the actual entry is not. Is there a way to NOT truncate the linked @handle?

Thanks for any directions.

Symphony 2.3.6
Select Box Link Field 1.29

I’d think this applies to the current versions too.

Ampersand in title causing handle issue

I have two sections:

section 1 - text input (SBL for section 2)
section 2 - SBL, text area

Text input on section 1 is;
value = title & text
handle = title-and-text

This is correct. However if I select this value for the SBL in section 2 I get the following output;
value = title & text
handle = title-and-amp-text

Note the extra 'amp' in the handle when using SBL. I think it has to do with the following line in the code (selectbox_link_field\fields\field.selectbox_link.php);

line 341: $value2 = General::sanitize(General::reverse_sanitize($value));

If I uncomment this line the handle is fixed, however it looks like this line was put in to fix a major security issue. So I really need to keep the line in, has anyone come across this before or know how I could fix this without causing any security problems?

Many thanks

Doesn't handle formatted values

I'm using the Typography formatter on the title of the linked field, and I'm seeing all kinds of nastiness. Has anyone seen this before?

Example

Filtering datasource by select box link with number string doesn't seem to work

Hi,

I wonder if someone can please help.
I have a site set up in symphony 2.6.7 using select box link 2.0

I have two sections;

  1. Gallery Categories - Title (forms SBL) and Image
  2. Gallery Images - Image, Select a Category (SBL)

I give a gallery category the title of '2015'.
I upload some images to the gallery images section and link them to the '2015' category. All is working great.

However I then create a data source for Gallery Images.

I filter the 'select a category' field for gallery images by the url parameter I have created for the gallery category title '{$gallery-cat-title}'. However this returns no results in the data source output.

If I change the gallery category title to 'test 2015' the gallery image data source is filtered properly and outputs the XML I would expect.

If anyone has seen this happen before or know of why it might be happening I would be grateful.

Thanks in advance

The sort order in the publish page is not set

Despite the text on the preference pane, the entries in the publish page are not sorted by date. So if a website has many many entries, the latest entries will never be shown.

Am I missing something, or should I submit a pull request for this (I have fixed this locally).

Broken caching/entry retrieval

Every time I try to use this field to link/retrieve entries that have ' (apostrophe) it breaks...

It always seems to be the caching SQL that breaks, so I don't know if it is this field itself, or the core MySQL class...

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4
An error occurred while attempting to execute the following query
SELECT SQL_CACHE e.id, e.section_id, s.name, s.handle FROM `sym_entries` AS `e` LEFT JOIN `sym_sections` AS `s` ON (s.id = e.section_id) WHERE e.id IN ()
Backtrace:
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/symphony/lib/toolkit/class.mysql.php:463] MySQL->__error();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/symphony/lib/toolkit/class.mysql.php:609] MySQL->query();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/extensions/selectbox_link_field/fields/field.selectbox_link.php:233] MySQL->fetch();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/extensions/selectbox_link_field/fields/field.selectbox_link.php:474] fieldSelectBox_Link->findRelatedValues();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/extensions/reflectionfield/extension.driver.php:102] fieldSelectBox_Link->appendFormattedElement();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/extensions/reflectionfield/fields/field.reflection.php:263] Extension_ReflectionField->getXPath();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/extensions/reflectionfield/extension.driver.php:131] FieldReflection->compile();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/symphony/lib/toolkit/class.extensionmanager.php:559] Extension_ReflectionField->compileBackendFields();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/symphony/content/content.publish.php:897] ExtensionManager->notifyMembers();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/symphony/content/content.publish.php:40] contentPublish->__actionEdit();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/symphony/content/content.publish.php:26] contentPublish->__switchboard();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/symphony/lib/toolkit/class.administrationpage.php:242] contentPublish->action();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/symphony/lib/core/class.administration.php:230] AdministrationPage->build();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/symphony/lib/core/class.administration.php:383] Administration->__buildPage();
[/Users/designermonkey/Projects/Symphony/finances/httpdocs/index.php:25] Administration->display();
Database Query Log:
SET character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'; [0.0001]
SET CHARACTER SET 'utf8'; [0.0001]
SELECT SQL_CACHE `session_data` FROM `sym_sessions` WHERE `session` = '3ed167ef15d8d13391f100d6e9009782' LIMIT 1; [0.0002]
DELETE FROM `sym_sessions` WHERE `session_expires` <= '1318189319'; [0.0001]
SELECT SQL_CACHE `name` FROM `sym_extensions` WHERE `status` = 'enabled'; [0.0001]
SELECT SQL_CACHE `id` FROM `sym_authors` WHERE `username` = 'john-porter' AND `password` = 'b064039c12eec87b0034061bc876418a82bca30c' LIMIT 1; [0.0002]
UPDATE sym_authors SET `last_seen` = '2011-10-23 20:41:59' WHERE `id` = '1'; [0.0002]
SELECT SQL_CACHE * FROM `sym_authors` WHERE `id` IN (1) ORDER BY id ASC; [0.0001]
SELECT SQL_CACHE * FROM `sym_extensions`; [0.0003]
SELECT SQL_CACHE * FROM `sym_authors` WHERE `username` = 'john-porter' LIMIT 1; [0.0002]
SELECT SQL_CACHE * FROM `sym_sections` ORDER BY `sortorder` ASC; [0.0004]
SELECT SQL_CACHE * FROM `sym_authors` WHERE `username` = 'john-porter' LIMIT 1; [0.0002]
SELECT SQL_CACHE t1.name, t2.page, t2.delegate, t2.callback FROM `sym_extensions` as t1 INNER JOIN `sym_extensions_delegates` as t2 ON t1.id = t2.extension_id WHERE t1.status = 'enabled'; [0.0003]
SELECT SQL_CACHE `section_id` FROM `sym_entries` WHERE `id` = '481' LIMIT 1; [0.0002]
SELECT SQL_CACHE `s`.* FROM `sym_sections` AS `s` WHERE `s`.`id` = '1'; [0.0002]
SELECT SQL_CACHE `e`.id, `e`.section_id, e.`author_id`, UNIX_TIMESTAMP(e.`creation_date`) AS `creation_date` FROM `sym_entries` AS `e` WHERE 1 AND `e`.`id` IN ('481') AND `e`.`section_id` = '1'; [0.0002]
SELECT SQL_CACHE `id` FROM `sym_fields` WHERE `parent_section` = 1; [0.0002]
SELECT SQL_CACHE * FROM `sym_entries_data_1` WHERE `entry_id` IN (481) ORDER BY `id` ASC; [0.0001]
SELECT SQL_CACHE * FROM `sym_entries_data_2` WHERE `entry_id` IN (481) ORDER BY `id` ASC; [0.0002]
SELECT SQL_CACHE * FROM `sym_entries_data_3` WHERE `entry_id` IN (481) ORDER BY `id` ASC; [0.0001]
SELECT SQL_CACHE `id`, `element_name`, `type`, `location` FROM `sym_fields` WHERE `parent_section` = '1' ORDER BY `sortorder` ASC; [0.0001]
SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND t1.`id` = '1' LIMIT 1; [0.0002]
SELECT SQL_CACHE * FROM `sym_fields_input` WHERE `field_id` = '1' LIMIT 1; [0.0002]
SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND t1.`id` = '2' LIMIT 1; [0.0002]
SELECT SQL_CACHE * FROM `sym_fields_selectbox_link` WHERE `field_id` = '2' LIMIT 1; [0.0002]
SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND t1.`id` = '3' LIMIT 1; [0.0002]
SELECT SQL_CACHE * FROM `sym_fields_reflection` WHERE `field_id` = '3' LIMIT 1; [0.0002]
SELECT SQL_CACHE `id`, `element_name`, `type`, `location` FROM `sym_fields` WHERE `parent_section` = '1' ORDER BY `sortorder` ASC; [0.0002]
SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND t1.`parent_section` = '1' ORDER BY t1.`sortorder` ASC; [0.0002]
DELETE FROM sym_entries_data_1 WHERE `entry_id` = '481'; [0.0002]
INSERT INTO `sym_entries_data_1` (`entry_id`, `value`, `handle`) VALUES ('481', 'Mama Tai\'s', 'mama-tais'); [0.0002]
DELETE FROM sym_entries_data_2 WHERE `entry_id` = '481'; [0.0002]
INSERT INTO `sym_entries_data_2` (`entry_id`, `relation_id`) VALUES ('481', NULL); [0.0001]
DELETE FROM sym_entries_data_3 WHERE `entry_id` = '481'; [0.0002]
INSERT INTO `sym_entries_data_3` (`entry_id`, `handle`, `value`, `value_formatted`) VALUES ('481', NULL, NULL, NULL); [0.0002]
SELECT SQL_CACHE * FROM `sym_sections_association` AS `sa`, `sym_sections` AS `s` WHERE `sa`.`parent_section_id` = 1 AND `s`.`id` = `sa`.`child_section_id` ORDER BY `s`.`sortorder` ASC; [0.0002]
SELECT SQL_CACHE COUNT(*) as `count` FROM `sym_entries_data_2` WHERE `relation_id` = 481; [0.0002]
SELECT SQL_CACHE s.handle FROM `sym_sections` AS s WHERE s.id = '1' LIMIT 1; [0.0001]
SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND id IN (3) ORDER BY t1.`sortorder` ASC; [0.0002]
SELECT SQL_CACHE e.id, e.section_id, s.name, s.handle FROM `sym_entries` AS `e` LEFT JOIN `sym_sections` AS `s` ON (s.id = e.section_id) WHERE e.id IN (); [0.0000]

Field Creation Error

Using the latest Symphony version in integration (2.3.3RC2), I get the following error when saving a section with a SBL:

Symphony Fatal Database Error: Unknown column 'hide_when_prepopulated' in 'field list'
An error occurred while attempting to execute the following query

INSERT INTO `sym_fields_selectbox_link` (`field_id`, `related_field_id`, `allow_multiple_selection`, `show_association`, `hide_when_prepopulated`, `limit`) VALUES ('5', '3', 'no', 'yes', 'no', '20')

It's a clean, new Symphony install. Seems like SBL is not installed properly.

"Display field’s value in entries table" breaks the `publish` page

Symphony integration + SBL 1.21.

Suppose you have a section called Beta with a select box link to a section called Alpha and the option "Display field’s value in entries table" ticked. When you visit the table view page for Beta, an error is thrown like this:

Unknown column 'ed.value' in 'order clause'
An error occurred while attempting to execute the following query

SELECT SQL_CACHE `e`.id, `e`.section_id, e.`author_id`, UNIX_TIMESTAMP(e.`creation_date`) AS `creation_date` FROM `integration_entries` AS `e` LEFT OUTER JOIN `integration_entries_data_13` AS `ed` ON (`e`.`id` = `ed`.`entry_id`) WHERE 1 AND `e`.`section_id` = '5' ORDER BY `ed`.`value` asc LIMIT 0, 17

Possible `not:` filtering problem

I have done some work on a project that uses the not: filtering from this field, and the results are very far from what is expected.

There are 4 entries in the table for the field, that have links to other fields, therefore have an ID in the relation_id. All of the other fields are empty (NULL) in the column.

When I'm doing not: filtering on this table, only these 4 rows are used to do the filtering. I would expect that all of the rows are filtered, and if having a NULL value would return as not.

Does this make sense?

Handling Associations

SBL seems to use functions that are no longer available in their old context in Symphony 2.4:

  • $this->removeSectionAssociation() is now SectionManager::removeSectionAssociation() and
  • $this->createSectionAssociation() is now SectionManager::createSectionAssociation()

Datasource-grouping only works for first associated section

I have the following scenario:

  • One "Images"-section is used to manage all images of two other sections "Projects" and "News".
  • The entries in the "Images"-section are associated to a single entry of on of these two "parent"-sections. I use a (hidden) SBL-field called "entry" for that.
  • I have a datasource called "images" that pulls all the images for the currently needed entries.
  • On specific fronted pages I have to show images for multiple entries, so I want to group the entries in the "images"-datasource by their parent-entry.

This results in the following buggy behavior:

  • The image-entries associated to entries of the first parent-section "Projects" show up as expected in the datasource (grouped by parent-entry).
  • The image-entries associated to entries of the second parent-section "News" simply disappear.

As soon as I turn off grouping all expected image-entries (of both parent-sections) are included in the datasource again. I also tried switching to a more fancy name than "entry" for the SBL-field - doesn't do a difference. I also tested this scenario with Association Field - obviously has the same bug.

Setup:

  • Symphony 2.6.11
  • Selectbox Link Field 2.0.0
  • Association Field 2.0.1

checkPostFieldData() doesn't work as intended

Latest integration code introduces checkPostFieldData, which doesn't work as intended.

The value of an SBL may either be an array ("allow multiple") or a string! In addition, there is nothing like $data['relation_id'].

If I replace this line:

$data = isset($data['relation_id']) ? array_filter($data['relation_id']) : array();

by:

$data = is_array($data) ? array_filter($data) : $data;

it works as intended.

Should I send a PR?

Broken with Symphony 2.3 fresh install

I have just downloaded from Github / master and starting getting to work on a fresh install. I first added dependencies (from Github also) and activating select_box_field break the blueprint/sections/edit/ pages. I tried to checkout master then working branches on git, re-installing plugin from extensions interface, but still not working.

from Apache log i got

[Sat Sep 22 14:28:42 2012] [error] [client 127.0.0.1] PHP Fatal error:  Call to undefined method fieldSelectBox_Link::properties() in whatever/extensions/selectbox_link_field/fields/field.selectbox_link.php on line 16, referer: http://whatever/symphony/blueprints/sections/

SBL linked to same section observation

Having read and implemented something similar to @gunglien 's setup for nested entries: http://www.getsymphony.com/discuss/thread/70113/2/#position-29

I came accross this oddity that needs clarifying.

If you have an SBL field linked to a field in the same section, and you link an entry to itself using said SBL... the backend renders fine, but in my setup, when the DS includes the SBL field, the front end encounters a php timeout and the page never renders.

Is there a reason why the SBL includes the ID of the Entry being edited in it's array of related entries? Is there an actual use case for this?

What would be better is if the SBL is linked to the same section, that the current entry doesn't appear as an option in the SBL selection drop down.. this would avoid the above php timeout from occuring.

This observation stemmed from trying to build nested entries and linking a page such as 'home' to itself using SBL, trying to use the backend like a client would.. i.e. without knowing not to link an entry to itself.. or even linking by mistake.

Thoughts?

Potential Bug after 2.2.5 -> 2.3 upgrade of database

Hi

I'm not sure if this is technically a bug or not but after upgrading a symphony install from 2.2.5 -> 2.3 and updating all the extensions I've come across an issue with the SBL field. What happens is:

Line 275: 'value' => $field->getParameterPoolValue($entry->getData($field->get('id')), $entry->get('id'))

Is throwing an error when the selectbox links to a field which has no data in it:

  • If I have an entry with no title and the selectbox links to it then this causes an error as getParameterPoolValue first param is NULL and it's expecting an array

By reverting the line (275) to:

'value' => $field->prepareTableValue($entry->getData($field->get('id')))

As it was in previous versions gets rid of the error.

Value shows handle

Since the 2.3 upgrade, the values in the selectbox are showing as the handle instead of the value.

Compatibility with Symphony 2.7.x

Currently, this extension has min="2.4" max="2.6.x".

Is there any issue with 2.7.x? If not, we should change the compatibility info. This is an important extension (needed for the bundle as well, AFAIK).

Filter by regexp

Hi all,
I don't know if it's an issue, I can't filter datasource by SBL field using 'regexp'.
Is it an issue or this functionality is not implemented? in the latter case, do you plan to implement in near future?

Thanks

Optgroups

Is there a reason why SBL uses an optgroup if the field is only related to a single section? It makes sense if the field points to multiple sections, but if it's only one it looks a bit messy – especially because the field is most likely named by the section it is associated with:

bildschirmfoto 2013-08-14 um 11 54 10

If the isn't a good reason to have the optgroup here, it should be removed from a visual design point for view.

Filtering with negation

No one's pointed out anything that I've done wrong in the related discussion at the forum, so I'm posting it as an issue. Apologies in advance if it does turn out to be an error on my part.

Symphony version 2.3.

SBL version 1.23.

I have a data source output parameter which represents the version of the site being shown:

<ds-versions.system-id>
    <item handle="1">1</item>
</ds-versions.system-id>

I'm trying to negate entries against this by filtering on a Select Box Link field (hide-on):

not:{$ds-versions.system-id}

not-regexp:{$ds-versions.system-id}

sql-null-or-not:{$ds-versions.system-id}

There may be none, one or multiple id's output by the SBL field.

Using either not:{$ds-versions.system-id} or sql-null-or-not:{$ds-versions.system-id} works when only one item out of my two in the SBL field being filtered on is selected, but if both are selected, entries which "should" be filtered out are still being included in the data source output.

It's as if when the SBL field is outputting more than one id, the comparison isn't able to be made with my filter value.

Sample output from an entry with both items in the hide-on SBL field selected which I'm trying to filter against $ds-versions.system-id when this SBL is included in the data source output:

<entry id="45">
    <title handle="advance-organisers">Advance Organisers</title>
    <hide-on>
        <item id="2" handle="m" section-handle="how2-versions" section-name="HOW2: Versions">m</item>
        <item id="1" handle="t" section-handle="how2-versions" section-name="HOW2: Versions">t</item>
    </hide-on>
</entry>

My suspicion is that because the SBL item with an id of 2 is output before the one with an id of 1, the 1 isn't being matched and so isn't filtered out.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.