/** * Overrides EntityReference_SelectionHandler_Generic::settingsForm(). * 0 = Makes the filtering configurable. Either show all nodes (filtered on * interface language) or show only those nodes with the same language as the * referencing (parent) node. */ public static function settingsForm($field, $instance) { $form = parent::settingsForm($field, $instance); $form['filter']['language'] = array('#type' => 'select', '#title' => t('Language handling'), '#options' => array(0 => t('Select all nodes matching with the interface language'), 1 => t('Select only nodes matching the parent\'s language')), '#default_value' => isset($field['settings']['handler_settings']['filter']['language']) ? $field['settings']['handler_settings']['filter']['language'] : 0); return $form; }
/** * Build an EntityFieldQuery to get referencable entities. * Note much to do but ensure our query has a property condation of status * 1 (published) */ protected function buildEntityFieldQuery($match = null, $match_operator = 'CONTAINS') { $query = parent::buildEntityFieldQuery($match, $match_operator); $query->propertyCondition('status', 1); return $query; }