We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [elementtype]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
40 views

Batch saving a custom field to multiple users via controller

I have to build a custom plugin for an internal user management system/data export that needs to be able to get triggered from the CP. I basically have to sort a big amount of users (1500+) in a ...
1
vote
1answer
42 views

How to support chained Element queries with Twig tags

The craft variable allows you to chain queries for your Elements. For example, you can query the first Entry in a section with either of the following syntaxes: {% set entry = craft.entries({ section:...
1
vote
0answers
31 views

Custom Element Reference Tags

I have created a custom element type and cant get the reference tags to parse correctly, I've set the refHandle and the action to copy reference tag which seems to be correct format when I copy a ...
0
votes
0answers
24 views

How to add an Element sortOption to sort by number?

I have an Element. It's a Structure, with one level (not sure if that is relevant). I'd like to add a Sort Option that allows a user to sort the Element Index page for this Element by a number. The ...
1
vote
0answers
67 views

Element type vs. Field type - or: Element type without database storage?

I have already searched for information on this topic but I did not find much. I hope I did not overlook something. My problem is the following: I want to try to write a plugin that lists entries ...
1
vote
0answers
27 views

Product in nested navigation

I'm currenty running Craft (v3) Commerce (v2) and have a difficult structure. This is my menu now: single home page. single about page. channel blog page. It has to be with the products in the menu,...
1
vote
1answer
54 views

How to enable changing the status of my own Element Type

So i have created my own Element Type and enabled statuses with the hasStatuses() method. In the ControlPanel its shown that each element has its own status, but it cant be changed. See image below: ...
2
votes
1answer
26 views

Is it possible to include a thumbnail in an element type index view?

I'm trying to emulate what Assets does, in which a thumbnail of the asset is shown along side the title of the asset. When I alter the _toString() method of the model, what I get is the URL instead of ...
1
vote
1answer
145 views

Element Type: Edit Page fields

I'm currently working on creating a full-sized Edit Page for my own Element Type. I created a elementSelectField and wanted to know if you guys have some advise or good articles to read on that ...
1
vote
3answers
371 views

How to check an elements elementType

In Craft 3, I've got a service function that I'm passing either an 'entry' or 'category' element into. I'd like to know how to differentiate between the possible element types; This kinda of works: ...
2
votes
1answer
105 views

How to extend Craft.BaseElementIndex for a custom Element Type

I have a custom Element and need to modify the Element Index page. I'm attempting to extend Craft.BaseElementIndex and register the extended class on my Element Index Page. I'm working on a plugin for ...
1
vote
1answer
91 views

Custom ElementType empty getSource criteria?

I'm trying to add a source on a custom element type that shows entries with an empty assigned_user_id field. This criteria is not honored and returns the same results as the "All Entries" source. Is ...
1
vote
1answer
208 views

ElementCriteriaModel andWhere() with different comparison operators?

I'm trying to do an andWhere() "OR" group for a special criteria value so basically when building an element criteria I want to just set `$criteria->upcomingOnly to true, and then have the following ...
1
vote
0answers
44 views

Save or efficiently query a count from a related table

I have two custom element types, Event and Booking. They are related via the eventId column on the Booking record which is a FK to the Event record. The Booking record also has a seats column. A ...
1
vote
1answer
238 views

Custom element type defineSearchableAttributes

I have a custom element type with 2 custom fields, 'name' and 'email'. I can't seem to get the index search working for this element type. I defined defineSearchableAttributes and returned an array ...
1
vote
0answers
42 views

Redirect from element action

I'm trying to process multiple elements in a custom element action, and then redirect the CP user to a url. How would I do that?
3
votes
1answer
247 views

ElementType CP section does not display table

I can not for the life of me figure out why my cp page will not generate the elements table. On other elementtype pages in the cp there is an XHR request made to a controller called "getElements" and ...
1
vote
1answer
90 views

getCriteria not working as expected with boolean field types

I have a custom content table for an elementType. I have a few fields set up in my Record as boolean. The two fields are approved and denied I have to search the database where both fields are set to ...
1
vote
0answers
81 views

Relating entries/users with a custom element (or custom database table)

Let's say I have a bunch of Craft entries and Craft users that I need to relate to another custom database table. How would one approach this? Would I be correct in thinking that my plugin will need ...
2
votes
2answers
358 views

Using getCriteria with a custom element type

I've setup a custom element type for badges for a system I'm building, but I've run into some trouble trying to query for badges using craft()->elements->getCriteria(ElementType::Badges_Badge);, ...
3
votes
1answer
158 views

Using relatedTo programatically?

I'm trying to extend the ElementCriteriaModel using the guide here: https://blog.tighten.co/craft-cms-building-complex-queries-by-extending-the-elementcriteriamodel However I need to re-implement ...
3
votes
1answer
120 views

What's the correct way to relate element types to a custom element type?

I'm working on a custom stock management plugin for a client's Craft Commerce site, and I need to have relations from my custom element type (used to keep a detailed log of stock changes) to the ...
1
vote
0answers
275 views

Getting type of element inside of a matrix field using plugin hook

I've been trying to deal with saving matrix fields to an external API by hooking onto the craft()->on('entries.saveEntry) function in a custom plugin I made. Matrices are nice for content authoring,...
7
votes
1answer
1k views

How to make use of Element Types

I am building a plugin in Craft, I want to use the Element Types, the documentation seems so hard to grasp. Can you give an example or a template code?
2
votes
1answer
204 views

How to duplicate an element type model with content?

Duplicating models is easy if you do it from the edit view, where you can just omit the ID and pass it along to save(). But how would I go about doing that programmatically without having a POST ...
1
vote
0answers
49 views

Ordering elementtype by custom field throws an error

In my plugin, when I go to the elementtype index page with the search bar and the dropdown for ordering by certain fields, when I choose a field which has been added through the fieldLayout, the ...
3
votes
1answer
328 views

How do I add a value to a tag field type using the entries service saveEntry method?

I am updating an entry using the entries service, I want to add a tag value into a tag field type (classifiedTags). $entry = craft()->entries->getEntryById(120); $entry->getContent()->...
1
vote
1answer
890 views

Eager loading EntryElementType from custom ElementType in a plugin

trying to get my head wrapped around eager loading element relationships in my plugin. A little context, I’m working on a navigation module and I have a Node element type, which belongs to a ...
2
votes
1answer
101 views

How to disable element editor on custom element type?

I'm working on custom element type and I'd like to disable the editor modal at element index view that appears when you double-click on status icons/thumbnails in the title column. Any help?
2
votes
1answer
77 views

How do I setup my Element Types Sources for deep linking?

In the Entries tab in the Control Panel, I see a list of Sources on the left hand side: All Entries Singles News When I click on each of these sources the page filters the appropriate results in the ...
4
votes
2answers
181 views

What would cause an custom element listing to just return everything?

I'm creating a plugin with its own ElementType, i've been using the Events plugin by P&T for reference, so I thought everything was going fine. Now when I go to my elements index, I seem to just ...
2
votes
1answer
142 views

Does defineSearchableAttributes() work with getter methods on the model?

If I define searchable fields via IElementType::defineSearchableAttributes(), the provided fields have to be model attributes. Can they also be getter-methods on the model class, which may return ...
0
votes
1answer
157 views

Customize elementSelect Field's Modal Table Layout

I am using the "Select Entry" field (_includes/forms/elementSelect.html) field in a custom plugin to select one of my custom element types. In my ElementType, I defined defineTableAttributes() and ...
3
votes
1answer
307 views

Plugin: Linking elementSelectField to own plugin models

I'd like to have an elementSelectField in my plugin. The goal is to select a Company which is defined by my plugin Model. So when clicked, it'll display a list of companies in the Dialog box and you ...
1
vote
0answers
64 views

Entries fieldtype

Is there scope for updating the Entries fieldtype so that only sections editable by the user are shown in the pop-up modal? Obviously don't want to go changing the core files, but some digging ...
1
vote
1answer
245 views

Use-case: custom plugin or extended use of entries/categories/tags

I have to integrate a jobs feed into our website and I've been digging in the documentation, reading the core's code for a while now, and I am in a dilemma trying to figure out if in out use case I ...
2
votes
1answer
141 views

Localize custom element types

I explored the events plugin (from https://github.com/pixelandtonic/Events) and I understand the most of that. Now I will try to make the events localized. The Event itself has no localized field, ...
1
vote
2answers
253 views

Change custom element Index title via getTableAttributeHtml?

I want to change the title in the index of an custom element. public function getTableAttributeHtml(BaseElementModel $element, $attribute) { switch ($attribute) { case 'title' : ...
3
votes
1answer
65 views

Detect currently selected source of custom elements

I have a split-style + New Element button for my custom element type. Thanks to this previous thread, the right-side dropdown menu is working perfectly! My question now is, how do I get the + New ...
4
votes
1answer
157 views

Split-style button for “New” custom element

I've got a plugin with a custom element. It evolved based on the basics laid out in the P&T Events sample plugin. On my element's index page, there's a big button to create a "New Element". When ...
1
vote
1answer
340 views

Complex search (and/or)

I want to search for Entries of the same channel/section based on their type. Let's say, we are a travel company with two types of tours: "guided group" and "private". For group tours, we want trips ...
5
votes
1answer
240 views

How to trigger updateElements when hide modal?

Is it possible to refresh an element's list when closing a modal? I have a modal ready with: onHide : function(){ //but all what I tried doesn't work here //1: This will do the trick, but ...
2
votes
1answer
356 views

Why does a Element Criteria Model Query with Strings on a custom element type not filtering?

having issues doing the classic element type query, works fine with numerical criteria (id, price etc.) but fails on strings, (code, name etc.). It just returns all elements. $criteria = craft()->...
3
votes
1answer
121 views

Filtering list in CP index page for new ElementType

I've created my first new ElementType based on the Events example. The only thing which doesn't seem to be working is the search bar above the listing in the CP. When I type anything into it I just ...
2
votes
1answer
153 views

Change title url of elementtype in the list

I have a plugin. In this plugin I did elementtype which extends the user one, but with only one source "clients". I have and New Client button which points to my plugin Plugin_ClientController which ...
0
votes
1answer
85 views

Create Plugin, Elementtype suggestion

Let's start with this I have Jobs, which would be added from the front end and backend as well, thouse jobs have to have Clients and Workers attached to them, which are basically users with differnt ...
3
votes
1answer
340 views

Eager loading relations in Plugins Element Type

I am creating an ecommerce plugin in Craft, and trying to take advantage of the ElementType. My goal is to list the orders, and also the items ordered in a single column. Is it possible to eager load ...
1
vote
1answer
851 views

500 error on admin/actions/elementIndex/getElements

Trying to get an element setup but when index is loaded, I get a "Unknown Error has occurred", diving into logs I found a 500 error was being thrown from the admin/actions/elementIndex/getElements url....
3
votes
0answers
202 views

How do I traverse relationships when populating models from queries?

I have three models / records - Journals, Issues, and Articles. Articles each BELONG_TO an Issue. Issues each BELONG_TO a journal. Issues have a date on which they've been published, and I am trying ...
1
vote
0answers
118 views

FieldElement Solr

for the last few hours im trying to come up with a way to use the craft field select in combination with SOLR, all my entries are in solr and i i want to keep using that. ive made it so that solr can ...