Completed
Pull Request — master (#168)
by Franco
02:41
created

code/cms/DocumentHtmlEditorFieldToolbar.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Extends the original toolbar with document picking capability - modified lines are commented.
4
 */
5
class DocumentHtmlEditorFieldToolbar extends Extension
6
{
7
    public function updateLinkForm(Form $form)
8
    {
9
        $linkType = null;
10
        $fieldList = null;
11
        $fields = $form->Fields();//->fieldByName('Heading');
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
12
        foreach ($fields as $field) {
13
            $linkType = ($field->fieldByName('LinkType'));
14
            $fieldList = $field;
15
            if ($linkType) {
16
                break;
17
            }   //break once we have the object
18
        }
19
20
        $source = $linkType->getSource();
21
        $source['document'] = 'Download a document';
22
        $linkType->setSource($source);
23
24
        $addExistingField = new DMSDocumentAddExistingField('AddExisting', 'Add Existing');
25
        $addExistingField->setForm($form);
26
        $addExistingField->setUseFieldClass(false);
27
        $fieldList->insertAfter($addExistingField, 'Description');
28
29
//		Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
0 ignored issues
show
Unused Code Comprehensibility introduced by
53% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
30
//		Requirements::javascript(SAPPHIRE_DIR . "/javascript/tiny_mce_improvements.js");
31
//
32
//		// create additional field, rebase to 'documents' directory
33
//		$documents = new TreeDropdownField('document', 'Document', 'File', 'ID', 'DocumentDropdownTitle', true);
34
//		$documents->setSearchFunction(array($this, 'documentSearchCallback'));
35
//		$baseFolder = Folder::find_or_make(Document::$directory);
36
//		$documents->setTreeBaseID($baseFolder->ID);
37
38
39
        //return $form;
40
    }
41
}
42