Skip to content

Commit

Permalink
Filters out Neo fields
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamminf committed Apr 24, 2016
1 parent 16da482 commit 5509c75
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
20 changes: 20 additions & 0 deletions quickfield/services/QuickFieldService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
namespace Craft;

class QuickFieldService extends BaseApplicationComponent
{
public function getFieldTypes()
{
$fieldTypes = craft()->fields->getAllFieldTypes();

if(craft()->plugins->getPlugin('neo'))
{
return array_filter($fieldTypes, function($fieldType)
{
return !($fieldType instanceof NeoFieldType);
});
}

return $fieldTypes;
}
}
2 changes: 1 addition & 1 deletion quickfield/templates/_fieldsettings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{% endif %}


{% set fieldTypes = craft.fields.getAllFieldTypes() %}
{% set fieldTypes = craft.quickField.getFieldTypes() %}

{% if field is defined %}
{% set fieldType = field.getFieldType() %}
Expand Down
11 changes: 11 additions & 0 deletions quickfield/variables/QuickFieldVariable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
namespace Craft;

class QuickFieldVariable
{
public function getFieldTypes()
{
$fieldTypes = craft()->quickField->getFieldTypes();
return FieldTypeVariable::populateVariables($fieldTypes);
}
}

0 comments on commit 5509c75

Please sign in to comment.