texts: Services custom resources issues - IIS, MSSQL

texts:
This really is two issues, but possibly both are related.

Main issue:

I have a custom resource setup in Services, the endpoint seems to be "mostly" working.  The endpoint is api/ada/ and my resource is named "assessment", so when I go to mydomain/api/ada/assessment/retrieve, it works.  I have an arg setup which is the assessmentID to retrieve and I'm returning a json array with just that ID for my test.

When I set the arg source to array('path'=>'0') it works, but the ID value in the json aray is the word 'retrieve'. When I set the path to '1' and go to mydomain/api/ada/assessment/retrieve/1 I get a "Controller not found" error in my console (using Chrome).

Secondary, but possibly related:

I have my custom module info file setup with files[] = includes/my_module.inc  which doesn't seem to work, so my callback in the above has to be in the same file for it to work. When I try to require 'includes/my_module.inc' or do module_load_include(...) it's outputting the file contents onto the screen rather than including them.  I'm certain this is an IIS config issue, but you'd think other modules would be doing this, but it's not, I get no other errors (or this type of output) across the site, though I'm less certain of that.

Anyway, I've setup a work-around using the hook_menu() functionality and setting up an "api" of sorts so I can build out the functionality while I recover from bashing my head on the desk trying to figure this endpoint issue out, but I get the module_load_include(...) error in this method as well, so I'm thinking maybe it's not entirely an issue with the Services Module.

Any help is greatly appreciated!

Link to code


texts:
I'm quite familiar with Drupal (Drupal 7, 8 and now 9), but never made a multisite. I've been looking for some documentation and I fear that it is yet not complete for D8/D9. Many references can be found even on Drupal.org that are working for D7, but not that much for D8/D9.
I've been searching on drupal.stackexchange.com quite extensively for this as well, but did not find something that could bring me forward.
The goal of my project is to have several smaller sites that all share the same base code. The setup is like

site1.mydomain.com
...
siteN.mydomain.com
management.mydomain.com

The goal is to manage all content from site1.mydomain.com to siteN.mydomain.com via site management.mydomain.com. As data from each siteX.mydomain.com is shared with management.mydomain.com, I've split the modules into master_siteX and custom_siteX.

Every master_siteX is located under modules/custom and contain the database table creations and the logic for the custom_siteX.
Every custom_siteX is located under sites/siteX/modules/custom you will find only the routing settings and some customization that would not affect the database or the logic of the master_siteX modules.

Settings.php under sites/siteX is the same for every site except the $settings['trusted_host_pattern'] which matches the site's URL.
sites.php in sites looks like:
<?php
$sites = [ 'site1'                   => 'site1'
         , 'site1.mydomain.com'      => 'site1'
         , ...
         , 'siteN'                   => 'siteN'
         , 'siteN.mydomain.com'      => 'siteN'
         , 'management'              => 'management'
         , 'management.mydomain.com' => 'management'
         , ];

self.site.yml for Drush contains something like:
site1:
  root: <path to Drupal root installation folder>
  uri: https://site1.mydomain.com
...
siteN:
  root: <path to Drupal root installation folder>
  uri: https://siteN.mydomain.com
management:
  root: <path to Drupal root installation folder>
  uri: https://management.mydomain.com

I've been able to activate site1 without any issue master_site1 and custom_site1. When I try to enable custom_management, I'm getting a message like :
Drupal|Core|Extension|UnknownExtensionException: The module does not exist in Drupal|Core|Extension|ExtensionList->getPathName()

Clearing cache makes things back to normal. But now I'm getting a warning in admin/reports/status telling me that :
The following module is marked as installed in the core.extensions configuration, but missing:
 ¤ custom_site1

Drush as well (local install) seems to be lost when executing commands
drush @site2 <command>

Only way to ensure things to work is using the GUI. Note that there is a known issue with Drush 10.3 and below when clearing cache on multisite setups in Drupal 8 and 9.
I must be doing something wrong when configuring my multisite, because it looks to me more like cheating/tweaking than something straight forward with segmented environments.


texts: How to create a filter in views which only shows contents that current user can edit?

texts: I set content access permission using nodeaccess_userreference module, I need a view to shows contents that user can change.


texts: How do you output views reference field views in Twig?

texts:
I'm currently trying to output views referenced in a node (with Views Reference Field) inside page.html.twig Twig template.

I know I can just add or embed a view using {{ drupal_view('machine_name', 'block_1') }} (with Twig Tweak) in my Twig template. But I want the editors to have the flexibility to add or change views in the node and have them printed without writing code.

I can't seem to find any documentation on how to output a referenced view to my Twig template.


texts: How to use both #anchor and ?destination parameter in a node/edit url?

texts:
I have a long page containing a node edit form and I wish to direct the user to a specific part of the page.

My URL is /node/12364/edit?destination=node/12360.

Where in the URL should I add the anchor?

I tried /node/12364/edit#anchor?destination=node/12360 but it doesn't work. The anchor is not used, the user isn't directed to a specific part of the page.

If I enter /node/12364/edit#anchor, it works but I need the destination parameter.


texts: Automated database history save and recovery Drupal 7

texts: I have a site implemented in Drupal 7. I want to make a history database recovery tool, which will recover previously recorded MySQL data. I have tested correctly on non-Drupal content which is used by the site. If I want to recover previous versions of Drupal content (just nodes and the info related), should I use a collaboration module? Which would be recommended? Should I restore the complete database or could I mysqldump and later mysql some selected tables (fields*, node*, etc.). Thanks!!!


texts: Get the node ID from the "node/add" menu item and hook_form_alter()

texts:
I want to set a unique 7-digit code to a custom content type and display it in a disabled textfield when a node is created. I created a CCK textfield and set it to disabled in hook_form_alter, great.

I think that a good way to make this unique ID is just to use the node id and fill it out to the required length (eg. 0000012). It doesn't look like $nid is available at the node/add form though. How can I set this ID field to default to the $nid? Can I access the hook_form_alter() as the content is created (on form submission)?


texts: Limit search results based on path patterns

texts:
We are running Drupal's internal search functionality but wish to limit it the results between a few 'sections'  of the site. I'm defining sections here based on URL patterns.

For example, suppose you had the following urls for a site.

http://example.com/artist_bios/
http://example.com/musician_bios/

I don't want to clutter search results with other irrlevlant information.

You want to know who is starring in Thursday's show vs the weekend special. Other times, you want to know who plays the cello in the ensemble.

Question: Is it possible to limit search results based on a URL pattern for something like the above example?


texts:
I'm new to drupal 7 and I'm having issues getting the smooth div scroll to work. What I'm going for is this! I also need it to be on every page of the site.

I downloaded the Zip file which is actually for this! I figured I'll alter the js and css files later. I placed in both sites/all/libraries and sites/all/modules. I copied the jquery-ui-1.8.23.custom.min file to /modules folder.

I then pasted this code to my template.php :

function best_responsive_preprocess_page(&$vars) {

//  if we are at frontpage, add some jquery code to do the animation
   if ($vars['is_front']) {
      drupal_add_js('sites/all/modules/jquery-ui-1.8.23.custom.min');
      drupal_add_js('sites/all/libraries/SmoothdivScroll/js/jquery.smoothdivscroll-1.3-min.js');
      drupal_add_css('sites/all/libraries/SmoothdivScroll/css/smoothDivScroll.css');
       $vars['script'] = drupal_get_js();
       $vars['styles'] = drupal_get_css();
   }
}

But that didn't do the trick.

What could be the issue here, or perhaps there is an another way to achieving this?

Many thanks.


texts: Use node custom field to choose my posts background

texts:
I'm building my first Drupal 8 theme and I'd like to add the possibility to change the page background header when editing a post.

I've added a custom field in my post type to provide an image to each post. It works, I can add an image and access the image url on my page.

The problem is that I can't find a way to add inline css to my page to add the background-image property.

Here's my code, located in my .theme file :

function hugo_preprocess_page(&$variables) {

  $node = \Drupal::request()->attributes->get('node');

  if($node->field_image_de_fond->entity) {
        $image_url = $node->field_image_de_fond->entity->url();
        $css_code = ".header-bg-home { background-image: url('" . $image_url . "'); }";
        $page['#attached']['css'][] = array(
              'data' => $css_code,
              'type' => 'inline',
              'scope' => 'header'
            );
  }

}

Any help would be really appreciated!

As it's my first D8 theme I'm really not sure about the way am doing that, it would probably be better to write a custom css stylesheet with the image url as a parameter, but I've no idea how to do that. Also, I'm not sure about the \Drupal::request()->attributes->get('node'); in terms of performances.


texts: Dynamic change the value of "select" based on other select values

texts:
Is there any way (without Javascript/jQuery) to dynamically show or hide value of select options based on other fields? For example from this code:
event:
  '#type': select
  '#title': 'Event Information'
  '#options':
    Class1: 'Class1'
    Class2: 'Class2'
    Event1: 'Event1'

currency:
  '#type': select
  '#title': Currency
  '#options':
    CAD: 'Canadian Dollar(CAD)'
    USD: 'US Dollar(USD)'

fee:
  '#type': select_other
  '#title': 'Tuition Fee'
  '#options':
    50: '50'
    60: '60'
    70: '70'
    '#other_type': number

So I want the "fee" options changes based on "Event" and "Currency". Is it possible with Drupal Webform?
What I did as a workaround to create different "fee" and show/hike it based on "Event" and  "Currency" values but probably not a good approach. The more values I add under "fee", there more instances of "fee" select I need to create.
Versions:

Drupal:  9.1.8
Webform: 6.0.3


texts: How to set access arguments visible to all

texts:
i have a simple module which show user to set email frequency but it's content can be seen by only to logged admin users , i want to change it to all the users,in drupal how can i do that

function emailf_menu() {
  $items = array();
  $items['emailfrequency'] = array(
    'title' => 'Manage email Frequency',
    'page callback' => 'emailf_page',
    'access arguments' => array('view content')
  );
  return $items;
}


texts: How to track users site use in a webform / contact form?

texts:
I was wondering if anyone knows a way of adding some data to the end of the emails I receive from a contact / web form, such that I can see what pages users (authenticated and unauthenticated) have visited prior to submitting the form?

Something like:

Here is the main body of the web form.

Before submitting this form the user visited:
/node/1,
/node/12,
/contact-us,
/node/45,
etc etc...


texts: What is the difference between the $config and the $settings variables in settings.php?

texts:
In the settings.php file of Drupal 8 installations, there are two different types of variables; $settings and $config. In Drupal 7 we used only $conf variable.

What's the difference between $config and $settigns variables in D8?


texts: display description and price field from a term reference

texts:
this is my setup: a vocabulary(pulp_toppings) containing 3 terms(honing, noten, brie). Each term also has a price field, I cannot find a way to display the prices of the terms :/ please help.

I have a line item with a term reference but it only references or displays the term titles.

So I could have toppings above my add to cart button but the prices of the toppings won't show.

I followed this tutorial(the screencast from Josh Miller about customizable items) to get the line item and taxonomy part: https://www.youtube.com/watch?v=j9KsyvQZaAY

What I need is either a solution for the above(changing the way my line item references the terms so also the price of the terms are shown) or a better way to handle toppings(not pricing attributes since it stopped working for me).

setup shown below:


texts: Select only one radio button in a webform

texts:
What I need to do is allowing to select only one radio button in a multi-column radios, but each column is in a
, so they are like in different groups. Here is an example of the code:

$form['submitted']['fieldset_time']['time8am'] = array(
  '#type' => 'radios',
  '#options' => array('8:30', '8:45'),
  '#prefix' => '
',
  '#suffix' => '
',
  '#title' => '8 a.m.',
  '#weight' => 8,
);

$form['submitted']['fieldset_time']['time9am'] = array(
  '#type' => 'radios',
  '#options' => array('9:00','9:15','9:30', '9:45'),
  '#prefix' => '
',
  '#suffix' => '
',
  '#title' => '9 a.m.',
  '#weight' => 9,
);

With this code, the radios are displayed in 2 columns but I can choose two options, what can I do to only allow to choose one?


texts: Validating and Modifying Form Data Simultaneously

texts:
I have a custom phone number field that I would like to be able to validate and modify simultaneously.

I want to make sure the field has a total of 10 digits regardless of the formatting.

The following values should all be 'valid'

555.555.5555
(555) 555-5555
(555) 555.5555
555-555-5555
5555555555

Can I have a validate function return a new value upon success? In essence, as long as there are exactly 10 digits present the validate function should return '5555555555' for every value above.


texts: How to make sure my behavior is triggered before AJAX?

texts:
I have a form elements that looks like this:

  $form['properties'][$property->idProperty] = array(
    '#title' => $property->Label,
    '#ajax' => array(
      'callback' => 'mymodule_filter_ajax',
      'wrapper' => 'mymodule-filter-result',
      'method' => 'replace',
      'effect' => 'fade',
    ),
    '#attributes' => array(
      'autocomplete' => 'off',
      'class' => array('exclusive'),
      'exclusivity_group' => array ( $property->ExclusivityGroup )
    ),
  );

The point of it is to have only one element from each group used at a time. To enforce that exclusivity, I created behavior like this:

(function($) {
  Drupal.behaviors.behavior_name = {
    attach: function (context, settings) {

      $('select.exclusive', context).on('change', function(){
        // Make all not selected
        $("[exclusivity_group='"+$(this).attr('exclusivity_group')+"']").not(this).find("option").attr('selected', false);
        // select "all"
        $("[exclusivity_group='"+$(this).attr('exclusivity_group')+"']").not(this).find("option[value='all']").attr('selected', true);
      });
    }
  };
})(jQuery);

Note that both code blocks above are simplified, please don't criticize it too much as this is not actual code I'm using posted verbatim.

How can I make sure my behavior acts before AJAX? If it happens to act after AJAX, I may end up with two fields set to something other than 'all', and that's specifically what I wanted to avoid. I may use $triggering_element to detect if it was one of "exclusive" fields, and I probably will, even if only as a secondary precaution, but I would strongly prefer to have things happening right in the JavaScript part.

I tried using this answer, but I don't think I understand how it works. I tried:

  $('select.exclusive', context).each(function(){
    console.log($(this).attr('id'));
    Drupal.ajax[$(this).attr('id')].options.beforeSubmit = function (form_values, element, options) {
      console.log(element.html());
    };
  });

First console.log returns IDs as expected. And it works, beforeSend is, indeed, changed as it should, it's function gets executed when needed. Sadly console.log(element.html()); returns content of a whole form, not the triggering element of AJAX, so I'm not able to safely enforce exclusiveness - I don't know which element was changed last, so no way to select other elements.


texts:
I have some pretty straightforward code that combines some string values together and then writes them to the db using drupal_write_record(), and it seems that the values are getting cut off for some reason when actually written to the database.

$keys_string = str_replace('|', '', $product->attribute_keys);
$values_string = str_replace('|', '', $product->attribute_values);

$keys = array_filter(explode('~', $keys_string));
$values = array_filter(explode('~', $values_string));

$description = '';
foreach ($keys as $key => $data) {
    $description .= $keys[$key] . ' : ' . $values[$key] . "\n";
}

$description .= "\n" . $product->group_text;
....

// Write record to database.
$table = 'ridethis_combined';
$record = new stdClass();
$record->title = $title;
$record->description = $description;
$record->short_description = $product->group_text;
$record->upc = $product->upc;
$record->sku = $product->vendor_item_id;
$record->cost = $price;
$record->price = $price;
$record->bti_quantity = $product->available;
$record->hawley_quantity = NULL;
$record->weight = NULL;
$record->manufacturer = $product->manufacturer_name;
$record->image = $image_url;
$record->meta_description = $product->group_text;
$record->meta_keyword = $product->group_text;
$record->meta_title = $title;

drupal_write_record($table, $record);

When stepping through the code in a debugger, I can see that prior to drupal_write_record, the full concatenated value is is stored in $record->description.  However, when I view the data in MySQL, only the concatenated values from $product->attribute_keys and $product->attribute_values is there; it's as if the $product->group_text data was never there.  The size of the db field is not an issue, since it has plenty of space for the content I'm writing to it.

Do you have any thought on what could be cutting this text off?


texts:
On a node field form (admin/structure/types/manage/article/fields), I have a dropdown with action links for all fields.

Edit
Storage Settings
Delete

I would like know if it's possible to unset the "Delete" link for a field please.
I have try with hook_link_alter() but I don't know how find and remove the link for a specific field (by example field_image).

Thanks.


texts: Disable message response when message was sent to all users of a role

texts:
Is it possible to disable the functionality to reply to a message, when this message was sent to all the users of a role?
I know it is possible to disable the functionality to reply to messages, but I only need it to be disabled when the message was sent to a particular role, all users of a role.


texts: Drupal Form API submission to create node

texts:
I have created a custom form in my module using Form API, the problem is it's kind of huge form (it consists lots of fields and fieldsets), I wanted to save the form as node after submission. I can create content type and map those fields, but the form is huge. I am looking for alternative way to do this  and by the way I have "Taxonomy terms" in my select list in my forms, I want them to be preserved as well while saving in node.

Thank you.


texts: How can I list only modules which need an update?

texts:
Drush 8.1.9 & Drupal 7.53.
What I'm looking for is a command like drush ups but without all the modules that are [OK] – so when used with an alias of several sites I don't have to scroll through loads. So all I get is:
aliasname
Name                               Installed Version  Proposed version  Message
     Metatag (metatag)                  7.x-1.19           7.x-1.20          Update available
     Views Slideshow (views_slideshow)  7.x-3.4            7.x-3.5           Update available

I found drush vset update_check_disabled 1 -y && drush -n -p up – it works but here's a sample output, which is not what I want.
media_ckeditormedia_ckeditormedia_ckeditor
views_slideshowmedia_ckeditor

I also want the version info. Is there anything I can do to get a list of all modules which need an update including the version info?


texts: I am trying to use hook_form_alter() to change the way a form is displayed. The form has 4 fieldsets and I only want to display one of them. How can I make these fieldsets invisible using hook_form_alter()?


texts:
I am using some contirb module and in which hook_node_validate is used. I am overriding the function passed in hook by running CUSTOM_MODULE_node_validate. But the contrib module validate also keeps running, is there any way that I can stop it running and let only mine one to run?

function CUSTOM_MODULE_node_validate($node) {

  $nodep = 'object' == gettype($node);
  $isrelevantp = _anonymous_publishing_relevantp($node, $nodep);
  if ($isrelevantp) {
    custom_anonymous_publishing_cl_content_validate($node); // function replaced with my custom for validation
  }

}

function custom_anonymous_publishing_cl_content_validate($node){
  ..........
}

ALREADY RUNNING IN MODULE:

/**
 * Implements hook_node_validate().
 *
 * The validate function will handle the honeyfield.
 */
function anonymous_publishing_cl_node_validate($node) {
  $nodep = 'object' == gettype($node);
  $isrelevantp = _anonymous_publishing_relevantp($node, $nodep);
  if ($isrelevantp) {
    _anonymous_publishing_cl_content_validate($node);
  }
}

function _anonymous_publishing_cl_content_validate($node){
  .......
}


texts: Looking for a special views exposed filter with pager and select list

texts:
i'm looking for an exposed views filter like it is implemented at the linked page.
Example here

a) While click on "1.Spieltag" there is a select list.

b) Also there are pager arrows to scroll through 1.Spietag 2.Spieltag ect...

Is there a module or a widget i have missed till now, with which i can achieve the described functionallity? Any other idea how to achieve this?

Thanks Tom


texts: Load Hierarchical list automatically from Hierarchical select option

texts:
I have this Hierarchical taxonomy structure

In content type, I have a taxonomy term reference to this vocabulary using Hierarchical List provided by Hierarchical Select Module. When I want to add the content, I get the default Select Option as:

(Note the Update Button Above). When I hit Update then only I get child terms of iPhone

Now, if I want to select Nokia instead of Apple

I don't get that Update Button, or I cannot change it until I refresh the page.

Is there any way the Child list (list in hierarchy) would load without hitting Update and change whenever I change the Parent list?

In short : I want to get rid of Update Button and load the Hierarchy List automatically when I change the value in the list.

If I select Apple, the list in the Apple would show.
If I select Nokia then Phones under Nokia would show without having
to hit Update or Refresh the Page.


texts: showing translation of the related node in view

texts:
I have a node type called Match. Each match have two entity reference fields that points to  two nodes that has the type of Team. I built a view and use the relationship to show the matches and the information of the host team and guest team and it's fine.
My problem is that the Team node is multilingual and I want to show the translation of Team fields in the view. It is obvious that the fields has a reference to the original untranslated node ID and when I use the relationship in the view it will grab that node even if it has translations.


texts: How to support fast year browsing in jquery UI Datepicker?

texts:
I am using jQuery UI Datepicker in an exposed filter of a view and I get the following Datepicker:

How is it possible to configure the Datepicker, so that I can quickly navigate through the years, either through a select or through arrows?


texts: How can I filter users within a user-configurable range in Views?

texts:
For example, consider a dating website.  Each user has an Age stored in their profile.  They also have a Max age and Min age, which are the maximum and minimum ages of people they hope to receive interest from (in other words, users with ages outside the range Min age - Max age should not be allowed to contact that user).

How can I build a page in Views that filters the results for the current user to show other users that both meet the current user's age range and for which the current user meets their age ranges?

In other words, I need to somehow filter the results like this:

Only show users that have ages within the range of the current user's Max age and Min age (example: current user is 20 and wants to see users from 18-25; filter to show users from 18-25)
Only show users for which the current user has an age that falls within the range of their Max age and Min age (example: current user is 20 and wants to see users from 18-25; filter to show users who want to receive messages from someone age 20)

Is this something I can somehow do with contextual filters, or do I need to write my own custom filter?


texts: How to export all users with all custom fields?

texts:
I want to export users list with all custom fields. I have tried the Users Export module but its export only below fields:

uid
mail
name
created
access
login

Is there any solution to solve this problem?


texts: How do I remove the site name from the head title in drupal 8?

texts:
The <title> element in the <head> of every page currently has the form
page_name | site_name. I would like to make this have the page name only site wide. I've found advice about how to do this in earlier drupal versions (eg here), but not for drupal 8. How is this possible?

Thanks


texts: Display values from exposed field in Views as a Dropdown

texts:
I am building an events website - so I have a taxonomy term Venue - and this, in turn, has a field Address, which is an instance of addressfield.

I need to expose the Locality field of the address to users.  I have this working fine, but it's displaying as a text field, since the original field is a text field.
http://journalofmusic.com/listings/test

I want the field displayed to users as a dropdown of all possible locality fields.

I have taken a look at this thread, and this specific comment:
http://drupal.org/node/1549250#comment-6653514

But I can't quite get it to work.  I've updated the example code to refer to taxonomy_term, and not node, and the locality field...

Below is the code. Can anyone suggest what I'm doing wrong here?

Thanks!

<?php
function dd_locality_form_views_exposed_form_alter(&$form, &$form_state) {
$field_id = 'field_address'; // change for the field in question

// Only alter forms with the necessary field
if (isset($form[$field_id .'_locality'])) {

// Build a query to get all term ids having the specified field
$query = new EntityFieldQuery();
$results = $query->entityCondition('entity_type', 'taxonomy_term')
->fieldCondition($field_id, 'locality', '', '!=')
->fieldOrderBy($field_id, 'locality', 'ASC')
->execute();

// Attach the field values to the terms
$terms = $results['taxonomy_term'];
field_attach_load('taxonomy_term', $terms, FIELD_LOAD_CURRENT, array('field_id' => $field_id));

// Add a default so the filter is optional
$options = array('' => '---');

// Buld the options array based on the query results, overwriting duplicate entries
foreach($terms as $nid => $term) {
  $value = $node->{$field_id}['und'][0]['locality'];
  $options[$value] = $value;
}

// Alter the field
$form[$field_id .'_locality']['#type'] = 'select';
$form[$field_id .'_locality']['#options'] = $options;
$form[$field_id .'_locality']['#size'] = 1;
  }
}
?>


texts: Views 2 Drupal 6 Filter Result if none of the fields have a value

texts:
What I need seems pretty straightforward but I cannot seem to accomplish it.

I have a view, a content pane to be precise, fetching specific fields of the node that it's parent panel overrides.

What I need, is for the view to return 0 results (and thus be hidden completely) if NONE of the fields are populated. If even one fields is populated I want it to display, but if NONE of the fields in question have a value I need the content pane to dissapear completely. I understand I have to do it with filtering and the NOT NULL option but I cannot understand how since in 2.x-6.x there is no AND/OR capability of what I can see.

Any help?


texts:
I'm trying to get current workflow state of a node to use in a function which will disable some tabs according to conditions.

$current_state = workflow_node_current_state($node)

didn't work. So, I coded a custom module contains:

function mycheck() {
  global $user;
  $node = node_load($node->nid)

  if (intval($node->workflow) = 3) {
    return false;
  }
  else {
    return true;
  }
}

The module at Drupal crashes... How can I get current workflow state of a node to use in a function (to use in a custom module) ?

Thanks in advance.


texts:
I am new to Drupal8.
How can i get the content ?
I call a view in page.html.twig like:

  {{ page.content.views_block__serviceboxen_block_1 }}

and created a template with name:

  block--views-block--serviceboxen-block-1.html.twig

How can i access to the content from my view in this template ?
I have no idea when i use

{% for row in rows %}

and

{% for item in items %}

thanks a lot.


texts: How can one determine if a view is empty using views_embed_view()?

texts:
I need to add a header to the page markup if a call to views_embed_view() retrieved any content, and hide it if not. Unfortunately, an empty view produces this markup:

<div class="view view-related-content view-id-related_content view-display-id-block view-dom-id-a62e1bda4cd2427adcbfba7ad95dec6e">

</div>

(I've left the spacing in to be as accurate as possible).

The view is set to hide results when the argument for the (only) contextual filter is not present.

How can I determine whether the view actually has any results, without incurring any extra DB overhead?

I'm looking to do this just with API functions as overriding templates for something so trivial is not palatable. I'm also not looking for any hacks (e.g. measuring the length of the return string and hiding the header based on that).


texts: ImageStyles does not create thumbnail image while uploading large images

texts:
I try to create a website using Drupal on a shared host, everything goes fine except ImageStyles.

When I try to upload large images (more than 1MB) thumbnails does not created , but works fine with smaller one.

I searched it and found these two:

Failing to create thumbnail, medium and large images

Image styles: Does not work with large images

but I can't use these solutions because I'm using a shared host.

Any suggestion will be appreciatived ;)


texts:
I have been trying to find the solution to this problem. I am referencing a serial of nodes with entity reference, but I just want to display the latest 3 nodes. Is there any way I can limit the results of the entity reference? I need to have unlimited Number of values but just need to display the last 3 for that case. I am not using views.

I am using Drupal 7

Thanks :)


texts: Form in a block with results is the same block

texts:
I have a custom module that uses a form in a block that will be displayed on a node page. This form is used to retrieve datas from a custom table.
What I want to achieve is :

The user arrives on the page : the form is displayed and the 10 lasts items retrieved from the database are also displayed
The user selects a data via the form
The user submits the form
The node page containing the block is refresehed with the 10 new items retrieved from database. I also need the form to be displayed on top of the block with previously selected values selected

I've been able to create a form class extending the FormBase class. Then I've created a block extending BlockBase class. In the build method I  get the form using the Drupal::formBuilder()->getForm() method

public function build(){

$form = \Drupal::formBuilder()->getForm('Drupal\my_module\Form\my_form');

  return array(
      '#theme' => 'my_theme',
      '#form' => $form,
    );
}

At that step, my node page + the block containing the form is correctly displayed, but I've not been able to render the default 10 last items. I've no idea on how to achieve this since the buildForm method of the form class is supposed to return an array to render the form. I've tried to implement it in the build method of my block :

return array(
      '#theme' => 'my_theme',
      '#items' => $items,
      '#form' => $form,
    );

It works, but after form submission, those first 10 default items are always displayed because the block build them on every refresh. Is there a way to know if the included form has been submitted ?

Concerning the form validation, redirection is definitly not the way I should go since a need the results of the database query to be displayed in the same page / block.

Based on this topic, I feel the $form_state->setRebuild() / $form_state->isRebuilding() methods are the way to go. Do you confirm ?

I've been able to refresh the item list after form submission doing so :

  if ($form_state->isRebuilding()) {
  $myfield_value = $form_state->getValue('myfield ');

  $model = Drupal::service('my_module.model');
  $items = $model->getLastItems(10, $myfield_value );

  return array(
    '#theme' => 'my_theme',
    '#form' => $form,
    '#items' => $items,
  );

}

This works, but only half of the time the form is submitted. The second time it's like it never passes in the if($form_state->isRebuilding()) {} statement. Moreover, the results are nested in the form markup. Maybe it's not the proper way to inject the form...

For information here is an example of my twig markup :

{{ form }}
<div class="row">
    {% for track in tracks %}
        {# print stuff...#}
    {% endfor %}
</div>

To be able to inject the form in the if($form_state->isRebuilding()) statement of the buildForm of the form class, I must wait the form array is completly defined in code... Doing so, I'm unable to set fields values to the ones the user has submitted.

In brief, my questions are :

How can I populate the default items list before the form is submitted ?
How can I properly inject the form from the if($form_state->isRebuilding() statement, so that everything works
How can I set the fields selected values after form submission.

Sorry for this long post, but I'm quite new to the drupal ecosystem, so any help would be greatly appreciated !...

Cheers

PS : I've also read about the BlockBase::blockForm and BlockBase::blockSubmit methods, but as far as I understand, it's more about block configuration froms. Does somebody confirm that ?


texts: Search Engine returning multiple 404s, Redirect 404 urls based on node id in the url

texts:
I am using Drupal 7. Many of my url paths (up to 6,000) have moved to new url paths with no 301 redirect so they are returning lots of 404s on google. i have paths like /articles/bla/bla-bla/12345 which moved to /articles/bla-new/something/12345

Since the old path which now returns a 404 has the node id in the url at the end, i want to redirect a path like this "/articles/bla/bla-bla/12345" to node/12345 once the system detects a 404

Any suggestions for using .htaccess redirect rules or other module to achieve this?

I've tried this: RewriteRule ^articles/*/+ node/+ [R=301,L] but it doesnt look right.

I need some help. thank you in anticipation


texts: Change "Public file system path" with Amazon S3

texts:
I want to keep my media files, all files in the "default/files" folder in the Amazon S3 account. I've opened the "admin/config/media/file-system" page and there is the "Public file system path" field, which by default is set to sites/default/files.

I can't imagine how can I connect my Amazon account with this file system path.

I'm using Drupal 7.


texts: How do I replace part of a webform component label with a variable token?

texts:
I have webform component labels like this:

Did [your pet] have any illnesses?

and I want to replace [your pet] with a variable token?

Do I need to write a custom module or can I do this by editing one of the theme .tpl files?

Tried this code as suggested:

<?php

/*
 * Implementation of hook_form_alter()
 */

drupal_set_message(t('Outwith the hook'), 'warning'); // display outwith the hook

function wit_bootstrap_form_alter(&$form, &$form_state, $form_id) {

drupal_set_message(t('Inside the hook'), 'warning'); // display within the hook

 // target my form / my field
  if ($form_id == "webform_client_form_1") {
    // target my form / my field

    if ($form['neutered']['#title']) {
        $title = $form['neutered']['#title'];
        $token_val = 'freelo';//get_tokenised_value(); // Which ever way you handle that...
        $title = str_replace('[your pet]', $token_val, $title);
        $form['neutered']['#title'] = $title;
    }
  }
}


texts: How do I disable update checks for locked projects?

texts:
I am using drush @sites cron in order to get update notifications in a Drupal 7 multisite configuration.
However, I need to have some projects locked, using drush up --lock=context_mobile_detect.

Example:

.var.vhosts.drupalmulti#example.com           >>  Name                     Installed Version  Proposed version  Message
.var.vhosts.drupalmulti#example.com           >>  Context Mobile Detect    7.x-1.3            7.x-2.0-alpha1    **Locked via drush.**
.var.vhosts.drupalmulti#example.com           >>  (context_mobile_detect)                                       (Installed version not
.var.vhosts.drupalmulti#example.com           >>                                                                supported)

Since this command checks many sites, it sends many unnecessary emails of the form: "New release(s) available for example.com", although most of the time no module needs to be updated.

Is there a way, using code or not, to disable update checking of locked projects?


texts: Ubercart product quantity count in product view page show as smsung 2/10 sold?

texts:
I added a product and say it has count of ten(of that product), If one is bought, then I want to show in the product view page out of 10/1 sold like that.

Is there any contributed modules available, or custom way to do it? I can add the quantity as field in the product content type, but what do I do after that?


texts: Why do I get redirected to userpage after login?

texts:
I land on the user profile page when I login as user. I would like to land on the front page after login.
How do I achieve that?

This is my basic site settings:


texts: EntityFieldQuery with fieldCondition returns nothing

texts:
I have created a custom entity, called 'point'.

I'm able to get all of the entities in the db, with this:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'point')
    ->entityCondition('bundle', 'point');
$result = $query->execute();

But when I add a fieldCondition, to make sure I only get the one single entity I want, I'll get an empty array back.

It looks like this:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'point')
    ->entityCondition('bundle', 'point')
    ->fieldCondition('field_point_unique_number', 'value', $unique_number, '=');
$result = $query->execute();

Where $unique_number is a textstring. And it's not a typo in the textstring.
In the db the field 'field_point_unique_number' is a varchar, but only contains numbers.

Why does the fieldCondition return nothing?


texts: Unable to add content in panelized page as administrator, how to overcome?

texts:
I'm Unable to add content to panelized page as a administrator. Is there any configuration hidden to overcome this?

An Ajax error pops up showing You are not authorized to access this page.

Only Uid=1(super user) has access to add content to the panelized pages.

  How to make other administrator users also have access to add content?

Only page content type is panelized.

Image:

Permissions


texts: How can I get the email address of a user who has just registered?

texts:
I need to add a hash key to users on register, generated from their email address and the current time, I added the field 'field_subscription_key' to user's fields and I hooked into

  custom_newsletter_mail_user_insert(&$edit, $account, $category)

in module's .module file, I have no idea how can I get the email address and time the user was created from these above parameters.

Also, I don't know how to get the user entity, so I would insert the hash key.


texts: Rules reacting on an event that hasn't happened?

texts:
Rules is acting weird all of a sudden. (v. 1.28)

It seems to be reacting on an Event that has not happened.

Using Commerce. Debug log shows that Rules reacts on the "Calculating the sell price of a product" event six times when I add a product to the cart, then reacts on "After adding a product to the cart", then reacts again on "Calculating the price", then reacts on "Select available payment methods for an order."

This last one seems really weird. We haven't even entered checkout. Why react on an event that definitely has not happened?

To make matters worse the Rules under the different events are firing multiple times, so I have customers receiving multiple emails and so on.

I have rebuilt the Rules cache. I have disabled Rules Conditional. I cannot understand why this is happening. Help, please?


texts: Can view HTML and PHP I wrote but install.php returns error

texts:
I installed Drupal8 for the first time to try things out. I used nginx and mySQL on FreeBSD with php-fpm for fastcgi. I have the nginx root set to /usr/local/www/drupal8 cause that's where the install.php file is. If I put a HTML file in there, I can view it with localhost/index.html. If I write a little info.php file, it runs and shows the expected phpinfo() data but if I try to do localhost/install.php, the address bar changes to localhost/core/install.php and nginx returns a 502 Bad Gateway and the nginx error log shows this:

  Call to undefined function Doctrine\Common\Annotations\token_get_all()
  in
  /usr/local/www/drupal8/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php
  on line 56" while reading response header from upstream, client:
  127.0.0.1, server: localhost, request: "GET /core/install.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host:
  "localhost"

I see this error in a few Google searches but the solutions are related to special programs or programmer errors. I followed directions on setting up php.ini and copied settings.php. I don't know what to do or where to look to fix this.


texts:
How to allow posting replies to comments to certain user roles only?
The goal is to allow users to post comments but not reply to them and have only certain roles able to post replies.

Initially I thought of hiding reply link for certain roles. But it is not a very bullet proof solution. Anyone knows of better methods?


texts:
I want to create a special content type that doesn't include the logo and main navigation. I have a helper module and have added the following section before renenabling it but it doesn't seem to be having an affect. What might I be doing wrong?

function myhelpermodule_page_alter(&$page) {
  if (current_path() == 'node/add/specialcontenttype') {
    unset($page['header']);
  }
}

Just in case I got "header" wrong, I've tried it with 'footer' and other regions to test it out and it seems to be having no affect at all.


texts: How do I change field handler_settings within hook_form_alter?

texts:
I have an entity reference field that is inside of a field_collection (D8) and I need to alter it's views arguments during ajax load to pass in the value from a preceding field on the host entity. I have everything working except I am not sure how to change the handler_settings on the field_collections entity reference.

Node
  - field_a: contains argument to pass to field_c
  - field_b: field_collection_item
    - field_c: entity reference field using a view for it's available options. Need to pass in views arguments to this field's handler_settings whenever I ajax load field_b.

So far I have field_b properly ajaxing in, but I am not sure how to alter the handler_settings. I have this to obtain the current handler_settings:

  $field_name = 'field_c';
  $bundle_fields = \Drupal::getContainer()->get('entity_field.manager')->getFieldDefinitions('field_collection_item', 'field_b');
  $field_definition = $bundle_fields[$field_name];
  $field_project_handler_settings = $field_definition->getSetting('handler_settings');

The output of $field_project_handler_settings is:

Thanks in advance!


texts: How to prevent negative userpoints transactions and checkout?

texts:
Some remarks on this issue were found in the question about How to prevent user point totals from going below a threshold for a given user? and related topics.

But there is also a question how to prevent checkout when a user tries buying a product which costs more than the user has on his balance/userpoints account.

Is there a universal solution (or not unique) to this problem for transactions and checkout at the same time?


texts: How to fix the PDOException shown after upgrading to Drupal 7

texts:
I upgraded Drupal 6 to Drupal 7.

The following updates returned messages:

  node module

  Update #7006

  taxonomy module

  Update #7005

  search module

  Update #7000

I updated the schema_version column of the system table for module above to higher number.

After all the pending update has finished running.

My front page website show error:

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column
  'base.format' in 'field list': SELECT base.tid AS tid, base.vid AS
  vid, base.name AS name, base.description AS description, base.format
  AS format, base.weight AS weight, v.machine_name AS
  vocabulary_machine_name FROM {taxonomy_term_data} base INNER JOIN
  {taxonomy_vocabulary} v ON base.vid = v.vid WHERE (base.tid IN
  (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0]
  => 6 ) in DrupalDefaultEntityController->load() (line 198 of /home/domains/site.com/public_html/includes/entity.inc).

How do I fix it?


texts: How can I invalidate cached field access grants for anonymous users?

texts: We have a Drupal 8 application that uses an event subscriber class to validate IP addresses against a table of white-listed addresses on kernel requests, and adds that value to a session variable. Basically, anonymous users with authenticated IPs can access privileged content on the site. I can use hook_node_access and hook_block_access to control access when appropriate, but hook_entity_field_access only fires once after rebuilding the caches, and not for each session, so field access seems more difficult to control this way. I've thought about injecting a service into my event subscriber and adding the necessary logic there for field access control, but I'm wondering if there's something easier that I'm missing about invalidating cache tags that would cause that hook to fire for each session.


texts: Get a views result using PHP code, and iterate the proper way

texts:
I have a view called all_projects_list. This view fetches Fields (not nodes), and i'd like to get it by code, and iterate on it. I managed to do this by using:

$view = views_get_view_result('all_projects_list', 'default');
foreach($view as $project){
    print_r($project->_field_data['nid']['entity']->field_project_code['und'][0]['value']);
}

Which as you can see is very, very dirty.
Is there a Drupal way of doing this ?
Thanks in advance.


texts: Drush 7 is not recognizing my Drupal sites, which were moved to new Virtual Host directory

texts:
On my laptop,  i’ve moved all my Drupal sites from a defunct AcquiaDevDesktop set up (stopped working!) into a new Virtual Host set up. I named the folder DevSites.

In trying to get the Drupal sites working properly I went to clear the cache using Drush, but Drush is not seeing these sites. When doing Drush cc all from within the root dir a Drupal site the response i get is 'No Drupal site found, only 'drush' cache was cleared. ‘

Drush is still installed on my the root dir of my computer. Can someone advise on what to do so Drush sees these Drupal sites.

Should i remove first and re-install?

I'm unsure of the current version. In the command line i type 'Drush -v'
it doesn't show a version number.


texts: Trying to get IMCE with Filefield Sources working (no Upload button in popup)

texts:
I've got a clean install of D6.22, CCK, Filefield, ImageField, Filefield Sources and IMCE. No other modules.

When i go to http://mysite.com/imce it all works perfectly (see screenshot).

But when i try to implement an image field with IMCE as a filefield source, i can click the "browse" link and the IMCE popup comes up, but the only button i get at the top of the popup is "Insert file". No upload, no delete, no resize etc. Here's the screenshot.

I see from the popup's page info that its URL is...
http://mysite.com/filefield/imce/page/field_pics?app=pics|url@edit-field-pics-0-imce-path
(the image field's human name and machine_name are both "pics").
I'm logged in as user-1, and the IMCE user-1 profile is looking good.

Also, there are no javascript errors, and if inspect the popup with Firebug, the upload button is there, but hidden. If I unhide it and click the button, I get the alert "You can not perform this operation". So it seems to be a permissions problem rather than a javascript problem.

I'm sure i've missed something so simple nobody's bothered to mention it in any of the docs. Can someone enlighten me?!


texts: More specific way to override THEME_process_page() function?

texts:
I'm going to explain my problem through the use of pseudo code.  Right now, i have in template.php the following code

function THEME_process_page(&$variables)
{
    if($variables->view == 'calendar')
    {
        // do something
    }
    else if ($variables->view == 'google_maps')
    {
        // do something
    }
    else if($variables->content_type == 'news')
    {
        // do something
    }
    else if($variables->content_type == 'event')
    {
        // do something
    }
}

Instead of writing a whole bunch of if statements for each view and content_type, can I do something like

function THEME_process_view_calendar()
{
    // do something
}
function THEME_process_view_google_maps()
{
    // do something
}
function THEME_process_content_type_news()
{
    // do something
}
function THEME_process_content_type_event()
{
    // do something
}

If this is possible, what's the correct way of naming functions to do this?


texts: Run feeds importer from outside the site

texts:
I have a Feeds importer that's running periodically (with cron) using "Feeds Fetcher Directory" fetcher. Now I need to run the importer on demand from other app outside the site. Is there a way to just run the importer (not cron) in a similar way as cron does? (going to some url)

I'm using Drupal 7.53.

Thanks!


texts: Core forum hook_menu_local_tasks_alter() override

texts:
i'm trying to implement lightweight topic tracker for core forums (tracking new topics and comments on main forum view).

I'd like to override forum_forum_load() method, but core forums calls forum_forum_load() method inside of a forum_menu_local_tasks_alter() and besides my overridden mymodule_forum_load() and mymodule_local_tasks_alter() it'll still call core forums own forum_forum_load() method making 2x more queries (2 x Amount of forums, in this case 28x2).

I replaced forum load function call inside of forum_menu_local_tasks_alter() with my own function and seems like it's working just fine, but I don't want to mess with the core, so I'd know if there is other way to prevent that behaviour.

I tried some other forum extending modules and they all have exactly same problem.


texts: How to auto assign node reference value D7

texts:
I have user profile with fields:

date field: "date of birth" (format: y-m-d)
node reference field "card_ref" which should automatically reference to content-type "cards" node. (users cannot change it only view it)

and content-type "cards":

title field
date field (multiple values, format: m-d)

so i'd like to make auto-reference to existing node "cards" which have same date-field value but different format.

For example:

I have "cards" nodes:
    (title - dates)

Card A - 01.23, 03.11, 05.02
Card B - 02.14, 07.01
Card C - 11.11
Card D - 02.10, 03.02, 05.07, 09.14

After new user registers his account with date of birth: 1977.07.01, I need "card_ref" field to automatically assign him "Card B"
or if entered date of birth: 1234.03.02, "card_ref" should be assigned to "Card D" and so on...

should i use custom module or it is possible to use some existing modules? maybe with views reference field, or rules?

any suggestions please? (for drupal 7)

Thank You..


texts: Changing "Product [product:title] added to your cart." message in Drupal Commerce

texts: I'm trying to change/customize this message and have found that it is generated by "Display an Add to Cart message" rule from Drupal Rules. Everything would be fine but I can't find this text and I also don't know what to alter (and how) to change this message. Does anyone tried to do this?


texts:
I am creating a new custom block; when I put HTML into the body and select Full HTML as text format, it gives me only the source code back. What might be the problem? This is a full HTML link I get from http://maps-website.com/.

 embed a google map

EDIT: While looking at developer's tools console, I noticed there is 403 forbidden error.


texts: "Call to undefined function views_get_view()" error

texts: What do I need to load before calling views_get_view()?


texts: How do I create a path alias and redirect node?

texts:
I want to create a path alias pattern like [base_url][title] and overwrite the existing path alias for a specific content type. Also, all the nodes are redirected to the new custom alias.

e.g., existing alias pattern is A/B/C and the generated url is www.test.com/de/A/B/C - Need to convert into www.test.com/C where de is language code here.

What approach should I take?


texts: How to hide the field names in a custom view?

texts:
I am new to Drupal and am working on a Drupal 6 (6.28) site. I have created a custom view and corresponding block which shows the most recent story created which has been promoted to Home. The view looks great except that it displays the "Title:" and "Body:" field labels before the Title and Body. How can I remove those?

Thanks in advance.


texts:
Is it possible?

I am trying to include a JavaScript plugin that works incorrectly when path is /script.js?hAsh.


texts:
I am trying to move the site from WordPress to Drupal 8, but there is one very unpleasant problem that I have been trying to solve for several days. I really hope that you will help me find the right answer.

I have a website with an overview of old Russian coins, which shows their average market price in dollars. I need to create a global field where I could enter the current exchange rate of the ruble to the dollar. For example - 67.88 rubles for a dollar.

It is very important that this field is displayed in hundreds of nodes and in one block and as soon as I change the values of this field, it has changed everywhere on the site.

I want to achieve the following result:

{% set priceindollars = content.field_price.value %}
{% set exchangerouble = content.field_roubles.value %}
{% set convert = priceindollars*exchangerouble %}
{{ convert }}

I dug over the entire network and I understand that the question is complex and non-standard, but I still hope for help from your community.


texts: There is a content type has a Field Collection type field(multi value), this Field Collection has a date field, I want to sort the node according to the max date value in this Field Collection field(multi value) in views, how to custom this views sort handler.


texts: Taxes is not shown in the cart. Using Drupal Commerce module

texts:
I'm using the Drupal Commerce module and I need to add some taxes to be shown in the cart.

Then, I added 2 taxes in admin/commerce/config/taxes following this video directions: video

First one is a VAT tax type which is shown correctly

Second one is a Sales Taxes tax type which is not shown at all in the cart

What am I missing? As far as I can see is not a permission related problem.


texts: How to remove a unique key in an update hook

texts:
I have a primary key and a unique key in my modules' schema.  I need to remove the unique key.

To remove an an index it is simple:

function draggableviews_update_7205() {
  if (db_index_exists('draggableviews_structure', 'entity_id')) {
    db_drop_index('draggableviews_structure', 'entity_id', array('entity_id'));
  }
}

There is a db_index_exists() function.  There is db_drop_unique_key() and db_add_unique_key() function, but no db_unique_key_exist().

How do I remove the unique key in an update hook?


texts: How do I create a node using web services and Anonymous user?

texts:
I have successfully installed the Services module and created a service with which I can retrieve a node or even several nodes (using Views Services)
I've now configured an endpoint, whose purpose is to allow an application to create nodes through a JSON call.

After much messing about I finally configured the following JSON call:

{
"type":"demande-de-rdv",
"uid":"0",
"language":"und",
"status":"1",
"promote":"0",
"sticky":"0",
"title":"JSON Post using http_request",
"body":"Morbi sit amet leo molestie, luctus metus aliquet, pellentesque lacus! Suspendisse at laoreet nulla. Nunc sed tincidunt dolor. Donec condimentum     odio non nisl condimentum, id euismod arcu rhoncus? Nullam sit amet ante convallis, viverra nulla in, laoreet leo. Fusce vitae iaculis libero. Phasellus scelerisque varius augue, quis vulputate sapien vehicula vel. Sed at est at felis dignissim rutrum. Sed porta tristique sapien et viverra. Nunc ac elit tristique, laoreet lacus at, pharetra elit. Morbi sit amet commodo dolor? Donec consectetur justo vel fringilla rutrum"
}

However, when I post the call I get the reply "403 : Access denied for user anonymous", this despite the fact that I have configured the content type to be creatable by Anonymous (and have created a node for the content type in question to test it). I also gave Anonymous all the permissions on the Services module just in case, but it made no difference.

Where i am going wrong?


texts:
I have configured the cmis and the cmis views modules to Drupal. I can access to my distant Alfresco repository when I test the different fields available.
My goal is to propose to my customer two way for inserting an image :
- basic upload
- from their alfresco server

I had various content types. So I created an image field and a CMIS Field.
If the user has his image in the Alfresco server, he will use the associate field (CMIS Field) and when he has it on his desktop he will use the basic upload field.

What is the way of getting the CMIS Field value in my template ?

EDIT 1 :
I tried to print_r the variable $row (The raw SQL result that can be used) and I found my field :

[field_test_alfresco] => Array
(
    [und] => Array
        (
            [0] => Array
                (
                    [path] => workspace://SpacesStore/bd8ck22c-452b-4d79-9616-2c163584036b
                    [title] => 1372936869055_content.jpg
                )

        )

)

I don't see how to use these data.

EDIT 2:

Thanks to this topic It seems that the module uses the method CMISService->getLink(), with the kind of path I displayed before, when you update or add contents to alfresco via drupal.

Maybe if we can create a CMISService object from my template...


texts: How to theme a view that displays content from a relationship?

texts:
I have a page for Organization. Each organization has a Featured Person field which is an unlimited node reference to the Person content type. The organization can have many featured people. I also need to be able to customize the markup for each view-row and therein lies my problem.

I set up the view according to another question. The view is able to select and display the correct Person data only when Show: Content. AFAIK, this does not let me customize the markup for each row because the rendered markup is sent directly to the template.

If I change to Show: Fields in order to get more control over the theming, the view will display the fields related to the organization, not the people (since I am on an organization page, and the contextual filter is set to the organization id, I suppose).

How do I set up my view so I can display the relationship content (Featured People) and still customize the template for each row or people?


texts: Add prefix / suffix to field by using template_preprocess_field

texts:
I remember in Drupal 7, this was possible. I need to add some HTML before a field and I don't want to edit it in the Twig file. Is it somehow possible to add prefixes / suffixes by using the template_preprocess_field function?

I already tried something like that, but with no success:

function MYTHEME_preprocess_field(&$variables, $hook) {
    $element = $variables['element'];
    if ($element['#field_name'] === 'field_genre') {
        $element[0]['#prefix'] = '
';
    }
    if ($element['#field_name'] === 'field_duration') {
        $element[0]['#suffix'] = '
';
    }
}


texts:
My database is getting way out of hand with respect to field_data... and field_revision...

is there any tricks in managing fields, seems really odd design method to me, I have over 100 tables just for fields alone.

I have tried to reuse the same field multiple time, but you cant use the same field more than once in the one content type.

ideally i would just have a field for each different data type and not every single field.


texts:
I am using the Book core module and book_helper, which is supposed to add some functionality.
However, I can only use book pages and then arrange them in a menu using weight.
How can I get previous and next links?
Also, I would like to show a table of contents, with navigation if possible, and chapters.
Thank you.


texts: jQuery only effecting first node in slideshow

texts:
I have applied a jQuery plugin [textfill][1] to certain elements within my a view and a view-slideshow. I have locally linked the relevant .js file via the .info file.

In the view-slideshow the first node is only effected
However in my other view all nodes are.

Within the views-slideshow i have attached the jQuery targeted class '.textfill' class through the views 'global: custom text field' and have added a div to the corresponding replacement pattern. With the normal view i have attached the class to the desired field via the corresponding field tpl.php file.

Here's what it looks like:
http://imgur.com/a/I4VV4/

This is the plugin:

; (function($) {
$.fn.textfill = function(options) {
var defaults = {
  debug: false,
  maxFontPixels: 40,
  minFontPixels: 4,
  innerTag: 'a',
  widthOnly: false,
  callback: null,
  complete: null,
  explicitWidth: null,
  explicitHeight: null
};
var Opts = jQuery.extend(defaults, options);

function _debug_sizing(prefix, ourText, maxHeight, maxWidth, minFontPixels, maxFontPixels) {
  if (!Opts.debug) {
    return;
  }

  function _m(v1, v2) {
    var marker = ' / ';
    if (v1 > v2) {
      marker = ' > ';
    } else if (v1 == v2) {
      marker = ' = ';
    }
    return marker;
  }

  console.debug(
    prefix +
    'font: ' + ourText.css('font-size') +
    ', H: ' + ourText.height() + _m(ourText.height(), maxHeight) + maxHeight +
    ', W: ' + ourText.width()  + _m(ourText.width() , maxWidth)  + maxWidth +
    ', minFontPixels: ' + minFontPixels +
    ', maxFontPixels: ' + maxFontPixels
  );
}

function _sizing(prefix, ourText, func, max, maxHeight, maxWidth, minFontPixels, maxFontPixels) {
  _debug_sizing(prefix + ': ', ourText, maxHeight, maxWidth, minFontPixels, maxFontPixels);
  while (minFontPixels < maxFontPixels - 1) {
    var fontSize = Math.floor((minFontPixels + maxFontPixels) / 2)
    ourText.css('font-size', fontSize);
    if (func.call(ourText) <= max) {
      minFontPixels = fontSize;
      if (func.call(ourText) == max) {
        break;
      }
    } else {
      maxFontPixels = fontSize;
    }
    _debug_sizing(prefix + ': ', ourText, maxHeight, maxWidth, minFontPixels, maxFontPixels);
  }
  ourText.css('font-size', maxFontPixels);
  if (func.call(ourText) <= max) {
    minFontPixels = maxFontPixels;
    _debug_sizing(prefix + '* ', ourText, maxHeight, maxWidth, minFontPixels, maxFontPixels);
  }
  return minFontPixels;
}

this.each(function() {
  var ourText = $(Opts.innerTag + ':visible:first', this);
  // Use explicit dimensions when specified
  var maxHeight = Opts.explicitHeight || $(this).height();
  var maxWidth = Opts.explicitWidth || $(this).width();
  var oldFontSize = ourText.css('font-size');
  var fontSize;

  if (Opts.debug) {
    console.log('Opts: ', Opts);
    console.log('Vars:' +
      ' maxHeight: ' + maxHeight +
      ', maxWidth: ' + maxWidth
    );
  }

  var minFontPixels = Opts.minFontPixels;
  var maxFontPixels = Opts.maxFontPixels <= 0 ? maxHeight : Opts.maxFontPixels;
  var HfontSize = undefined;
  if (!Opts.widthOnly) {
    HfontSize = _sizing('H', ourText, $.fn.height, maxHeight, maxHeight, maxWidth, minFontPixels, maxFontPixels);
  }
  var WfontSize = _sizing('W', ourText, $.fn.width, maxWidth, maxHeight, maxWidth, minFontPixels, maxFontPixels);

  if (Opts.widthOnly) {
    ourText.css('font-size', WfontSize);
  } else {
    ourText.css('font-size', Math.min(HfontSize, WfontSize));
  }
  if (Opts.debug) {
    console.debug('Final: ' + ourText.css('font-size'));
  }

  if (ourText.width() > maxWidth || ourText.height() > maxHeight) {
    ourText.css('font-size', oldFontSize);
  }
  // call callback on each result
  if (Opts.callback) Opts.callback(this);
});

// call complete when all is complete
if (Opts.complete) Opts.complete(this);

return this;
};

})(jQuery);

this is my other .js file

jQuery(function(){
   jQuery('.textfill').textfill({ maxFontPixels: 200 });
});

i also should note that i am a relative beginner to drupal aswell as using stackerexchange


texts:
I've been building custom entities for a while now, but have been using the entity construction kit (eck) to build them. This has limitations as it requires you to #1 depend on the package for new installs, and #2, wrap your entities into a feature and hope there aren't conflicts later.

I would like to get into the world of building out the entity types programatically, on module install, as well as removing them on module uninstall.

I was recently diving into an ECK created entity I made that I exported into a feature, and it looks like the feature for the entity type is in the correct format for if you were to programatically create the entity. I have been trying to learn by looking at documentation on how to build a custom fieldable entity (with bundle) for a while, but all the documentation I have found has either been inconsistent, or spread all over the place making it difficult to follow.

My question is, could I in theory copy the field_instance.inc, field_base.inc, and the features.inc (where the entity is defined at), and plug that into my modules hook_install() and create my entity inside of the install file, instead of having to rely on ECK and features? I should note that I am also using the conditional_fields module so that I can dyanmically show/hide certain fields inside of this entity and save time on building my own ajax functionality, so I would probably need to build the entity out so that the fields can be updated from the Fields UI if needed (but usually they'll be updated in hook_update_N.


texts: How might I create a "step-by-step process" content type?

texts:
I'm thinking about creating a process manual for an intranet. Most (all?) of the processes have a very clear order, although the actual order may change from time to time. The plan is to have the subject matter experts, probably a half-dozen or so, enter and update the process pages. The users of the site need to be able to quickly review the processes while interacting with customers, often face-to-face.

Here's the options I've thought of:

Train the authors to use ordered lists. Pro: easiest for me. Con: relies on training non-technical people, could be hard to style for readability.
Organize each process into a book. Pro: uses something that's already there. Con: harder to enter, complicated to read.
Create a content type with a "step" field that could be entered unlimited times, and theme so as to show the order number. Pro: easy to see that each step is independent, can be reordered easily (?) Con: more work for me (I feel like there something else in this option that I'm missing, but I can't put my finger on it!)
Custom module, something like the Recipe module but w/out ingredients. At least I'm assuming the Recipe module has step-by-step directions. Pro: most customization for entry, learning experience. Con: a LOT more work for me, kinda out of my expertise.

From your experience, is there a clear winner among these options?

Is there an option I'm missing? (is there a module out there that already does this, for example? Googling this concept was a nightmare.)

Am I over-thinking this?

I don't know yet whether this project will be Drupal 6 or 7.


texts: Replace Views prev/next pagination with image arrows

texts: Is there a template that would allow me to replace Views' prev/next text pagination with image arrows instead? I could do it with CSS but I don't feel that is ultimately an optimal solution.


texts: Drupal 8 Remove book child pages with in the content block

texts: I am looking to not show Book child-pages within the content and only show them in sidebar region. So I anticipate not to hide them using css but remove the child-pages that gets called automatically within the main content (near to the end of the content block)


texts: Add a JOIN with a subquery into a views query

texts:
Here's my SQL, which I am trying to include in hook_views_query_alter() to modify the uc_catalog view (from Ubercart 3):

JOIN (
   SELECT uc_products.nid, MIN(uc_products.sell_price) AS min_price
   FROM uc_products
   JOIN node as n ON n.nid = uc_products.nid
   WHERE uc_products.nid IN
   (
     # in an ideal world, this is the WHERE statement from my views query
     SELECT ti.nid AS nid
     FROM taxonomy_index ti
     WHERE ti.tid = :db_condition_placeholder_1
     AND n.status = :db_condition_placeholder_2
     AND n.type IN :db_condition_placeholder_3
     GROUP BY uc_products.model
   )
 ) AS s2
 ON node.nid = s2.nid AND uc_products.sell_price = s2.min_price

I am confused as to how to make this work with the tools in views_plugin_query_default since this SQL has a subquery, etc. that is more complex than a simple JOIN statement.  I am having a hard time conceptualizing using add_relationship or add_table to make this work.  Is there something about $join building I don't understand.


texts:
I want to show a list of Twitter users who is following a post, with a button that allows the users to follow them. The list should appear as in the following screenshot.

I have tried using the Twitter, and oAuth modules but I had no luck, so far.


texts:
I really hope somebody can help me out with this: I'm designing a Drupal 8 project and I'm using the built-in CKeditor to edit articles. But the image popup renders outside of screen bounds and I can't find how to fix that. There seems to be no way to influence the top parameter of the dialog.

Thanks a lot!

Matt.


texts: How to change order of javascript files in Drupal 6?

texts:
I would like to change the order of my javascript files, and specifically move the jwplayer.js file so that it gets included after the jquery_ui*.js files.  Does anyone know how to do this?  I see how to do this in Drupal 7, using hook_js_alter().  But I do not see how to do this in Drupal 6.

UPDATE:
Here is some more information on my setup, that might be relevant:
- I call drupal_add_js('jwplayer.js') from within a custom views template.  The template adds jwplayer.js conditionally, depending on whether the views data includes any videos.


texts: I've got content-type includes 'field1', field2' and 'field3'. These fields are integer value. Thanks to Views module I created page 'Page1' with contents. In main menu I've got search whit some filters. After filling filters and entering, we can see appropriate contents in 'Page1'. I'd like to create filters or fields in search to allow user to fill in 'min' and 'max' values. After it I want to choose a content only if 'field1' or 'field2' or 'field3' of that content is beetwen 'min' and 'max'. How can I do it?


texts: Watermarking images with direct direct URL

texts:
I have installed image cache actions module to watermark all images shown in my juicebox galleries.
when I access them by following url which is reading from styled folders, it is properly showing the watermarked images

http://localhost/drupal/sites/default/files/styles/photo_gallery_resize/public/field/image/design.jpg?itok=MSjmkfIa

But unfortunately my original images are still accessible by direct URL without watermarks:

http://localhost/drupal/sites/default/files/field/image/design.jpg

What can I do to watermark images accessed by direct URL or protect them from being shown.


texts: How to add section titles to group fields in content type input form used to create content?

texts:
Is there a module or setting to provide a title to sections of the content type input form used to create content?

For example - a job application form would have sections:

Section Title: Your Details
- Name
- Address

Section Title: Previous Employment
- Employer etc

Section Title: Qualifications

Happy to consider writing a custom module to output HTML and CSS to do this but wondered if there was a module or setting.

I'm currently using display_suite to do some layout design of the form in-browser.

(I've done some research and have seen https://drupal.org/project/multistep module but I would prefer all the sections on one page at the moment, that module may be useful for something else, though. Also aware of https://drupal.org/project/field_group which I expect to use but not sure if it provides titling above the field group).


texts: How to add terms directly from the content overview?

texts: I have a few taxonomies with custom fields. I would like the user to be able to add terms directly from the content overview page at admin/content, and for the terms to be listed there - without having to navigate to the taxonomies page. As if the taxonomies were a content type. Any suggestions?


texts:
I have done the following:

rule component with action send email notification.
rule that schedule the component "after saving a content".

When I go to schedule I can see that the rule fires the scheduled component and when I execute it.. the email sent successfully.

I have created another rule with Event "after updating existing content" and "Delete scheduled tasks" as action to cancel the component above.

But unfortunately it doesn't work.. and when I go to schedule nothing appears for canceling the task.

Any help?


texts: How can an Entity Reference filter against another field?

texts:
In Drupal 8, I have a content type for "Advances" that contains an Entity Reference field to "Technology". Each instance of an Advance should be of a certain type of Technology, which has Prerequisite technology types. The goal is therefore to have the Technology entity reference limited only to those contents whose Prerequisites appear in the Advances' existing related Technology data.

For example, the Technology "Optical disc" would have the Prerequisites "Laser", "Plastic". While adding a new Advance, the related "Technology" list to select from would include only those Technology data whose Prerequisites are in the existing Advances data. Therefore if the Advances already include "Laser" and "Plastic", then "Optical disc" would appear in the Technology select list. If "Laser" and "Plastic" do not appear in Advances, then "Optical disc" would not appear in the Technology select list.

I have set up an Entity Reference Display View. With this I can filter the Technology data in the select list. For example, I have set up a "Filter Criteria" option for Prerequisite as Not Empty, so that only Technology data with at least one Prerequisite appear in the select list.

However, I have not found a way to filter the list so that only Technology data with their Prerequisite data appearing in the Advances data appear in the select list.

I have looked through all the Filter Criteria and Contextual Filters. I do not see any way to accomplish this. From web search results, it appears that Drupal 7 had a PHP contextual filter, which could potentially have helped, however I do not see this in Drupal 8.

Also, some other questions seem to suggest a Global Fields Comparison Filter, although this also seems to have disappeared from Drupal 8.

How can one filter an Entity Reference according to values that appear in a field?


texts: How can I add new components to a fieldset?

texts:
I'd like to customize the webform everytime the user saves a webform node.  I'm using rules with a custom action that updates the webform when the user saves the node.  Looking at devel, I haven't been able to figure out what the proper key to specify a parent fieldset is.

In my action I have the following:

for ($j = 1; $j <= 5; $j++) {
  $node->webform['components'][$i] = array(
    'nid' => $node->nid,
    'cid' => $i,
    'pid' => 0,
    'form_key' => "participant$j",
    'name' => "Participant",
    'type' => 'fieldset',
    'value' => '',
    'weight' => $j,
    'display' => array(
      'addmore' => $i,
    ),
    'extra' => array(
      'description' => 'Please provide the participant information listed below. Required items are denoted with an asterisk.',
      'title_display' => 0,
      'private' => 0,
      'collapsible' => 1,
      'conditional_component' => '',
      'conditional_operator' => '=',
      'conditional_values' => '',
    'mandatory' => 0,
    'page_num' => 1,
    ),
  );
  $i++;

  $node->webform['components'][$i] = array(
    'nid' => $node->nid,
    'cid' => $i,
    'pid' => 0,
    'form_key' => "first_name$j",
    'name' => 'First Name',
    'type' => 'textfield',
    'value' => '',

    'parent' => "participant$j",
    'extra' => array(
      'display' => array(
        'addmore' => $i,
      ),
      'title_display' => 'inline',
      'private' => 0,
      'disabled' => 0,
      'unique' => 0,
      'maxlength' => 60,
      'width' => '',
      'field_prefix' => '',
      'field_suffix' => '',
      'description' => '',
      'attributes' => array(),
      'conditional_component' => '',
      'conditional_operator' => '=',
      'conditional_values' => '',
    'mandatory' => 1,
    'page_num' => 1,
    ),
  );
  $i++;
...


texts: Feeds remove item with certainly conditions

texts:
Good day

I have a problem with the side of developer

with certainly conditions i need remove a item from source. for example i have in source

nid and phone1 and phone2

but if phone2 is the same that phone1 remove, all this is in updates nodes

function custom_feeds_before_update($source, $item, $entity_id){

  $entity = node_load($entity_id);
   if (isset($item['phone 2'])) {
      if($entity->field_phone_1['und'][0]['value'] == $item['phone 2']){
         unset($item['phone 2']);
      }
  }
}
function custom_feeds_presave($source, $item, $entity_id){

  $entity = node_load($entity_id);
   if (isset($item['phone 2'])) {
      if($entity->field_phone_1['und'][0]['value'] == $item['phone 2']){
         unset($item['phone 2']);
      }
  }
}

something i make wrong? none working never unset if i make dpm in item no appear the item but if i see the node appear update, is other hook

thanks for any help


texts: I wonder if it's possible to hide a view (as block view) if it has less than X results.


texts: What if I don't want node pages for content type?

texts:
I am creating a node type that I don't want to have a separate node page for. I am going to use a page view to pull them into a list. And they will link to a URL that is stored in a field for the content type.

These are simple content types and there is no need for them to have a node page. I know I can avoid having a page for them just by having no way to get there, but is there anything else to think about.

Maybe they should be something else besides a content type? Or is there a better way to not have node pages for a content type?

Edit:

I'm not really trying to prevent people from viewing these nodes. If they want to get to the node with the URL then that's fine. The nodes are just very simple(title, short blurb, link) and the node page would be pretty useless. I am just wondering if I shouldn't use some other Drupal construct for something like this.


texts: Content type node not overwriting the default node.tpl.php even if I have cleared all cache's

texts:
I have a content type with a machine name of 'empresas' after reading the documentation I should be able to just create a node--empresas.tpl.php to toy with the output of this in my theme.

it seems to be not overwriting it. I am trying to hack something together and I am using the twitter bootstrap Drupal theme.

I have seem a similiar problem into another post in this forum but it seems like taht is not may problem because he have solve it by clearen all the cache's but that was not my case.


texts: Entity Reference field in custom line item missing multiple field values

texts:
I added an entity reference field to a line item within commerce.

Target is user, entity selection is done through a custom view. The view populates the values of a date field within the actual user entity. The preview works as desired, the field has 3 values and those 3 get shown in the views preview.

However looking at the add to cart form it always shows just the last value of this multiple value field. Why are not shown all 3 values in the add to cart form?


texts: Programmatically uploading and validating a user_picture

texts:
I use the following code to modify the image in the user_picture field of user with uid 42:
// Get user.
$user = \Drupal\user\Entity\User::load(42);

// Create file.
$file = file_save_data(
  file_get_contents('/tmp/image.jpg'),
  'public://pictures/image.jpg'
);

// Set file.
$user->set('user_picture', $file->id());

// Save user.
$user->save();

It works great, but it's very simplistic and doesn't do any of what has been configured in /admin/config/people/accounts/fields/user.user.user_picture, e.g:

Validate "Allowed file extensions".
Possibly downscale based on "Maximum image resolution".
Save image in the "File directory" location.
Validate "Maximum upload size".

Is there a way to somehow upload and set the file through what has been configured in the field?


texts:
How can I add a Preview in JSON local task?

My link is exactly the same of entity.node.canonical, but I have to add a query string (?_format=json). I know how to add the local task, but I don't know how to append the query string to the URL.


texts: I want to change the contact setting flood limit, but I don't find the correct place. How I change the flood limit for sent messages?


texts: Programmatically created field doesn't appear in Views fields

texts:
Here is my little module that adds "markup" field to commerce_product table, but I can't select and display it in Views:

function comm_markup_schema_alter(&$schema) {
  $schema['commerce_product']['fields']['markup'] = array(
    'type' => 'float',
    'not null' => TRUE,
    'default' => 1,
    'description' => 'Price markup field',
  );
}

function comm_markup_install() {
  $schema = drupal_get_schema('commerce_product');
  db_add_field('commerce_product', 'markup', $schema['fields']['markup']);
}

function comm_markup_uninstall() {
  db_drop_field('commerce_product', 'markup');
}

function comm_markup_entity_property_info_alter(&$info) {
  $properties = &$info['commerce_product']['properties'];
  $properties['markup'] = array(
    'label' => t('Price markup'),
    'type' => 'decimal',
    'description' => 'Gross price multiplier (defines profit amount).',
    'schema field' => 'markup',
    'getter callback' => 'entity_property_verbatim_get',
    'setter callback' => 'entity_property_verbatim_set',
  );
}

UPD:

function comm_markup_views_data_alter(&$data) {
  $data['commerce_product']['markup'] = array(
    'title' => t('Price markup field'),
    'help' => t('Multiplier. Adds profit to the gross price.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
}


texts:
I need to update term references on nodes without updating the "changed" timestamp on the node.
If I use VBO with "modify entity values" as action I can update the term reference but it will also update the "changed" timestamp.

How can I code a custom VBO action?


texts: How to remove url alias when node is deleted

texts:
I am using Pathauto. When I deleted a piece of content, I was surprised to find that its url alias was still mapped to the now-nonexistent content (node/xxx).

How can I have this alias and System name mapping removed automatically when the node is deleted?

Edit:
I want to keep the Update action set to "Do nothing. Leave the old alias intact.", because I don't want paths to change when nodes are adjusted. However, it doesn't make sense to keep a path around if the node was deleted completely. Can I have both options somehow?


texts: Content profile image (CCK imagefield) instead of default drupal picture

texts:
tried what igorik said on drupal.org == http://drupal.org/node/609454#comment-2172258
Placed user-picture.tpl.php in my theme directory and replaced code inside it:

<div class="picture">
<?php print $picture; ?>
</div>

to:

<?php
$img_url = $content_profile->get_variable('profile', 'field_photo');
print l(theme('imagecache', 'msg_profile_pic', $img_url), 'user/' . $account->uid );
?>

but all what im getting after these actions is WSOD... set to display errors true in index.php, but still can't see any errors. Help me guys! Thanks


texts: Regex field validation producing false (?) negative

texts:
I've also asked this question in the module issues, since I'm not sure if it is a bug or something I'm doing wrong.

I'm trying to use the Field Validation module to apply a regex control to ensure that a Philippines cell phone number is correct, and I'm getting what seems to me to be a false negative.

These numbers are 63, followed by 8 or 9, then followed by 9 digits.
I've created a control using the Regex (PCRE) rule, with the following format:

 ^63[8-9]\d{9}$

and yet it persistently gives me false negatives, for example on this: 639121129374

I can't see anything wrong with the regex, and I've tried testing my numbers on regex101.com (cool tool) and they work fine. Is this a bug, or am I doing something wrong?


texts: How can I dynamically set the site URL (in Drush9+)?

texts:
In Drush 8 I had that neat little reusable line in my drushrc.php:
$options['l'] = getenv('MY_SITE_URL_VAR');

I know that I can hardcode my site URL in a drush.yml file, but that does not fit my configuration workflows, where each server knows its URL.
So how can I set the l option from an environment variable?


texts: How to allow arbitrary query string with url alias?

texts:
Using Google Custom Search and as part of it's configuration I specify a callback url on my site (e.g., www.example.com/search).  I setup my page www.example.com/search as a Basic Page.

When someone searches for something they are taken to the url I specify and arbitrary query string parameters are appended (e.g., www.example.com/search?cx=partner&ie=UTF-8&q=dom&sa=Search&siteurl=www.example.com/search).

However this results in a page not found because Drupal appears to treat the entire request path as a url alias which it can't find.

How can I allow arbitrary query strings?


texts: Choosing which comments field to display when published

texts:
I'm using the basic comment module to allow users to leave comments (name, phone, email, comment, and rating) on each resource for that specific comment type. One of the fields is an option to allow users to choose to share their personal information to others if they want. All comments are unpublished by default and have to be moderated to be published.

So, my question is this: how can I selectively choose to publish a users email or not depending on if they selected to share that information with others?

Either a manual or automatic way would work fine. Thanks!


texts: How to add a country to the location module?

texts:
I have a requirement to add additional countries to the location module.

I need to add England, Scotland, Wales and Northern Island.

I suppose they could be provinces, but I can't figure out how to do that either.

Many thanks for any help :)

PS. I would be using the county codes for css so country would be better.


texts: Extending module modal_forms for any content type field?

texts:
Has this been done or in another module?

I'd like a lightbox to appear for a particular field.

Alternatives I'm working on are to use the bootstrap lightbox (extension library) and some jquery, but would prefer something not tied to a theme.


texts: Why doesn't a certain block appear on "view" pages of my site?

texts: After much searching online, I can't figure out why my "search" block is not showing up on every single page of my website. I went to the configure screen for the block and ticked the "All pages except those listed" radio button and didn't list any pages in the field below. So that should make the block appear on every page of my site, correct? That's not the case, however; there are a handful of pages, most of which are "views" (i.e., the page shows a series of tabs -- View, Edit, etc.) where the block simply doesn't show up. Am I doing something wrong?


texts: Automatic adding of the subject to the contact form

texts:
I have the block that is shown in every node of one content type. The block contains the link (the anchor tag) which leads to the page with contact form.

Is it possible to add subject automatically to the contact form depending on which page the user clicked on the link and came to contact form page? The subject would be the title of that page.

I use Webform module for the contact form.


texts: Adding a jQuery UI widget in the administrative front-end

texts:
I have created a form within the administrative front-end in my Drupal 7 site to allow administrators to change some configuration options. I've defined the path to it in the following way (in hook_menu):

$items['admin/config/system/my_site_name/status'] = array(
  'title' => 'Change site status',
  'description' => 'My description',
  'access arguments' => array('administer site configuration'),
  'page callback' => 'drupal_get_form',
  'page arguments' => array('my_form_name'),
  'file' => 'forms_file.inc',
);

I want one of the items in this form to be a jQuery UI slider, bound to a hidden select element that has its same value, which is then fetched in the form's submit method (pretty much like in here: http://jqueryui.com/slider/#hotelrooms) by creating a .js file with the following.

(function ($) {
  Drupal.behaviors.site_status = {
    attach: function(context) {
      var select = $("#edit-site-status");
      var slider = $( "

" ).insertAfter(select).slider({
        min: 0,
        max: 4,
        range: "min",
        value: select[0].selectedIndex,
        slide: function( event, ui ) {
          select[0].selectedIndex = ui.value;
        }
      });
      $( "#edit-site-status" ).change(function() {
        slider.slider( "value", this.selectedIndex);
      });
    }
  }

})(jQuery);

However, I've been unable to load the widget, as it seems the whole jQuery UI js file is missing.

  TypeError: $(...).insertAfter(...).slider is not a function

According to http://redhotchilliproject.com/blog/jquery-and-jquery-ui-in-drupal-7, I should manually load the jQuery file in some preprocess function, like this.

function MY_THEME_preprocess_page(&$variables, $hook) {
  drupal_add_library('system','ui.slider');
}

However this method doesn't get called from the page that contains my form. I've even tried to load the jQuery library in MY_THEME_preprocess() without any luck.

I don't want to include the file in the my_module.info file, as I only need the slider to be in the administrative front-end and most users won't need it.

How can I get this slider to show up?


texts: Why submit button is losing disabled attribute after deletion of uploaded file?

texts:
The task is simple: submit button must be enabled only if file is attached to file input.

The form code:

function custom_module_form($form, &$form_state) {

    $form['#attributes']['enctype'] = 'multipart/form-data';
    $form['xml_file'] = array(
        '#field_prefix'      => ''.t('Only XML files are allowed').'',
        '#type'              => 'managed_file',
        '#title'             => '',
        '#default_value'     => '',
        '#upload_location'   => CUSTOM_MODULE_UPLOAD_DIR,
        '#upload_validators' => array('file_validate_extensions' => array('xml')),
        '#required'          => TRUE,
    );

    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
    );

    return $form;
}

The form alter code:

function custom_module_FORM_ID_form_alter(&$form, &$form_state, $form_id) {
    if (! isset($form_state['clicked_button'])
        || $form_state['clicked_button']['#name'] == 'xml_file_remove_button') {
        $form['submit']['#disabled'] = TRUE;
    }
}

It works, but when I removed uploaded file by Remove button, refreshed form has enabled submit button, even if I am sure that above code was executed. What am I doing wrong?

Use case:

Go to page with a form, submit button is disabled - ok
Uploaded sample xml file:

Click the Remove button, form is refreshed but submit button is enabled instead of disabled


texts: Store predefined information (independent from source) in target's field with Feed importer

texts:
I'm quite new to Drupal, but I'm fascinated of it since I started to learn it.

However, I've a specific problem which I'm trying to solve since a few hours and so I thought to ask for help.

I use the Feeds module to import press releases from several companies. So, I've for every company an individual "Feed importer" that imports press releases to a content type "Press release". I've also a content type "Company" that contains information about the company. My problem is that I want to add the company to the press release's field "Company" (Entity Reference). But, unfortunately, I don't manage it because it is only possible to add information that is imported, i.e. in the mapping I can only assign information of the source that is stored in a field of the target. But I want to store a predefined information ("Company") in a field of the target.

Example: I've a Feed Importer for the RSS Feed of Siemens and everytime a feed is imported I want that the field "Company" of the content type "Press release" is filled with "Siemens". That's all!

Thanks for your help!


texts: "Signature" user field not appearing in list of user fields

texts:
I have the Drupal core Signature field that appears on the user edit page; it doesn't seem to show up as a field on the Manage Display tab when I go to re-order and group the fields on the edit page.

Does anyone know how I can get this field to appear in the field list with the rest of the fields so I can group and reorder it?


texts:
For the last couple of days I've been getting the following error:

  Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /home/mydomain/public_html/drupal/includes/database/mysql/database.inc on line 46

This comes after my Hosting did an upgrade and PHP is now version 5.2.17.  From what they have told me, I think I have to enable a PDO MySQL extension in php.ini.  The problem is I'm on a shared hosting and I don't have access to the file; also, my Hosting said they can't change it either.  My info.php shows:

  PDO

  PDO support enabled
     PDO drivers sqlite, sqlite2

  pdo_sqlite
     PDO Driver for SQLite 3.x enabled
     PECL Module version (bundled) 1.0.1 $Id: pdo_sqlite.c 293036 2010-01-03 09:23:27Z   sebastian $
     SQLite Library 3.3.7

I tried modifying the .htaccess file and/or adding my own php.ini file to the root directory per some suggestions I found, but nothing I've tried has worked yet.

Can anyone please suggest what else I could do?

EDIT:

Once again I asked the Hosting to enable PDO_MySQL extension and their answer was that they could not, that cPanel (to which they migrated from Plesk, causing this whole problem) had this extension disabled by default and changing it would affect their servers.  Their solution?  That I would change my programming to adjust to these new features, which I wouldn't even know how to go about.  Are they right requesting that I do this? Is there any other way?