texts: How drupal keeps revisions for some content types only

texts:
In Drupal 6 for some content types when editing a node its replicated and keeps revisions for that content type by keeping vid (version id) for that in the table, But for some other content types it wont make new table entries when editing that content types . How is it like that ? Or is there any criteria to keep revisions for some content type only ?

update from comment

The revision information can be done when creating a  content type item itself , but how come its auto selected for some content types ?

2nd update

When creating a new content type i can see the options as follows :

But as you can see , revision settings is inside submission form settings  but **its disabled** here , how i can set revisions for particular content type only for some content type only .


texts: Open Layers map not showing pointers drupal7

texts:
I have created a content type in drupal 7 and added a reference to a taxonomy term.The taxonomy term has geofield data i.e Longitude and Latitude.
The challenge is when I create a view and use an Openlayers data overlay following what is provided in the open layers documentation I do not have a pointer on my map. Could there be anything I am not doing right here?


texts: How can I redirect users after they cancel their accounts?

texts:
Is there a way redirect users after they cancel their accounts?  I've configured my site to allow users to cancel their accounts without e-mail confirmation, but I want to be able to redirect them to a "goodbye" page to reassure them that their account was in fact cancelled.

In user_cancel(), though, account cancellation is performed with the Batch API.  I tried adding a drupal_goto() after the call to batch_set($batch), but this forces the goto and the batch processing is not performed.

How can I redirect non-admin users after they cancel their accounts?


texts: Variable saved as string, not as integer

texts:
I have a problem when updating a variable with return system_settings_form($form) - Basically, I store a variable as an integer, but when I press Save configuration, it works very well except that it saves the variable as a string, not an integer.

Here's my function:

function my_module_settings() {
  $form['my_variable'] = array(
    '#type' => 'select',
    '#title' => t('My module variable'),
    '#description' => t('Update my module variable.'),
    '#options' => array(
       1 => t('Set it to 1'),
       2 => t('Set it to 2'),
       3 => t('Set it to 3'),
    ),
    '#default_value' => variable_get('my_variable', 3)
  );
  return system_settings_form($form);
}

So, if I select "Set it to 2" in the select list and hit save, I'll be getting number 2 surrounded by quotes ("2"). I've confirmed with PHP gettype that there's indeed a change of data type.

I wonder if it's related to the select list or something foolish I'm doing? I've tried using a checkbox instead and data type is correctly updated as an integer.

I've been scratching my head without finding a correct solution. Any idea what's going on?


texts:
All path aliases are entered by hand. I need them to be language independent. Currently they are created/updated in the language that the user is currently using which does not make sense in case of my site.

I tried using hook_path_insert and hook_path_update but they only receive the $path by value and not by reference and changing the function to hook_path_update(&$path) results in an error.

How to change the language of inserted or updated paths to LANGUAGE_NONE using a module? Alternatively, how can I force all aliases to be language independent automatically when user enters them? I don't think it is not possible; it is possible to allow them to choose the "All" language, but not force it.


texts:
I'm working on an input.html.twig file. I need the label name of the input for class and other reasons, but for some reason, I can't figure out how to grab it. I thought it would be part of the twig variables but I don't see it when I use kint().

So I tried using preprocess but it's not showing up.

function cougar_preprocess_form_element(&$vars){
$element =& $variables['element'];
$vars['test'] = 'test';
$vars['title'] = ['#markup' => $element['#title']];
}

I'm at a loss how to add the title to the input field twig file


texts: Object of type stdClass cannot be printed when received JSON response

texts:
I have:
$result = $client->request('POST', 'http://'.$core_address.':'.$core_port.$core_uri, [
    'body' => json_encode([
        'a' => $a,
        'b' => $value['v'],
        'x' => $value['x'],
    ]),
    'headers' => [
            'Accept' => 'application/json',
            'Content-Type' => 'application/json'
    ],
]);

$output = json_decode($result->getBody());

i catch the output and print it like:
drupal_set_message($output);

problem is: if output just a flat string, it work like a charm
but when it receive json like:

{'x': ['Not a valid integer.'], 't': ['Not a valid string.'], 's':
['Not a valid string.']}
192.168.yyy.xxx - - [28/Jul/2016 00:14:59] "PUT /Module HTTP/1.1" 200 -

it give me error:

Uncaught PHP Exception Exception: "Object of type stdClass cannot be
printed." at /path/to/Drupal/Core/Template/TwigExtension.php line 443,
referer: https://url.com/admin/core/my/module/path

why? why?


texts: Adding to the Font Options in CKEditor 3

texts:
I want to add a custom font to the font options for the CKEditor module, but it doesn't work.

I added this in ckeditor/config.js.

I added this in ckeditor/font.css.

However, my custom font doesn't show up in the CKEditor font menu.

I'm working with CKEditor 3.6.


texts: How to disable javascript validation of html5 URL element?

texts:
The LinkWidget uses a URL render element, which behaves differently in different browsers.  In chrome, there is annoying pop-up, which is out of character with other validation within Drupal where there is an error message at the top of the page and a red border added to the form element.

In order to gain more control over the validation, I'd like to do away with the javascript (i.e. HTML 5) validation.  There are various suggestions using javascript or CSS, but they are heavy handed as the most effective method is to set the "novalidate" parameter on the entire form, which loses the benefit of validation on other html 5 elements such as email or dates.

What is a good way to turn this off for link fields that are set to accept external links?  (If you also accept internal links, this doesn't happen).


texts: How to determine the code for settings.php config override based on .yml?

texts:
I am trying to put my API keys in a separate file instead of storing them in config management.

For example, I installed the Commerce Stripe module.

When I export the config, it looks like this:

commerce_payment.comerce_payment_gateway.stripe_test.yml

uuid: 430a9544-c852-4a14-b7b0-3a833a02dd06
langcode: en
status: true
dependencies:
  module:
    - commerce_stripe
id: stripe_test
label: 'Stripe Test'
weight: null
plugin: stripe
configuration:
  publishable_key: thisishidden
  secret_key: thisishidden
  display_label: Stripe
  mode: test
  payment_method_types:
    - credit_card
conditions: {  }
conditionOperator: AND

Now, I want to store publishable_key and secret_key in a file, but how do I determine the "path" to call them?

$config['whatgoeshere?']['configuration']['secret_key'] = 'abcdefg';


texts: How to set a value programatically only when a content type is saved for the first time?

texts:
I'm trying to record the user agent string into a text field (field_useragent) the first time a content type is saved.  This is what I tried:

/*
 * Implements hook_ENTITY_TYPE_insert()
 */
function mymodule_node_insert(Drupal\Core\Entity\EntityInterface $entity) {
  if ($entity->getType() == 'my_content_type') {
    // Log the user agent.
    $entity->set("field_useragent", $_SERVER['HTTP_USER_AGENT']);
  }
}

But, this doesn't save the user agent string.  So I tried using this code:

/*
 * Implements hook_ENTITY_TYPE_presave()
 */
function mymodule_node_presave(Drupal\Core\Entity\EntityInterface $entity) {
  if ($entity->getType() == 'my_content_type') {
    // Log the user agent.
    $entity->set("field_useragent", $_SERVER['HTTP_USER_AGENT']);  }
}

This saves the user agent string, but it does so every time the node is edited.  How can I save it only upon insertion?


texts: At creation time, why are shortcut titles translated, but menu link titles are not?

texts:
The idiom that the community points to for creating menu links usually looks like this (from \Drupal\Tests\language\Functional\LanguageSwitchingTest::testLanguageSessionSwitchLinks()):
// Add a link to the homepage.
$link = MenuLinkContent::create([
  'title' => 'Home',
  'menu_name' => 'main',
  'bundle' => 'menu_link_content',
  'link' => [['uri' => 'entity:user/2']],
]);
$link->save();

Note that the title is not run through t().
But, yet, the idiom for shortcut links (from standard_install()) is:
// Populate the default shortcut set.
$shortcut = Shortcut::create([
  'shortcut_set' => 'default',
  'title' => t('Add content'),
  'weight' => -20,
  'link' => ['uri' => 'internal:/node/add'],
]);
$shortcut->save();

Note that the title is run through t().
Why are shortcut titles run through translation at creation time, but menu link titles are not? Aren't shortcuts a type of menu link? Shouldn't they be handled the same way?


texts:
is there a way in drupal 8 to use two different editors (CKeditor with two different buttonpanels or two differently allowed html tags) in one content type?

I have created a content type of a text field (body) and with the module paragraph other text fields are created. the user should use the possibilities in the body field of pictures and tables but in the text fields of paragraph the user should not be allowed to do so.

I have now created two different editors but the user can always switch between the editors. How can I determine that only one editor can be used in the body field and only the other one in the remaining text fields?
many thanks for your help!
s-webz


texts: How to create a table without uninstalling and reinstalling the module?

texts:
I have a module and an installation file that is used to create a table.

According to my requirement, I need to add an another table in the same install file. I know that by using hook_schema() we can create n number of tables.
But we need to uninstall and reinstall again to create the tables. If I use this, my existing data will be lost, so I am not supposed to do this.

Is there any way to create a table without uninstalling and reinstalling the module?


texts:
I have a specific tpl being defined within the theme and the specific view function contains a function that calls the webservice.

It saves it within the items array which then outputs as variables to the tpl file. However, there is another tpl which is an alternative view for original file but currently has no values.

To fix this, in the original webservice, i store it within sessions and grab data that way. What would be the drupal solution??

function EXAMPLE_theme(){
  return array(
    'list_view' => array(
      'template' => 'list-view',
      'variables' => array('items' => NULL)
    ),
    'table_view' => array(
      'template' => 'table-view',
      'variables' => array('items' => NULL)
    )
  );
}

function list_view($form_state){
  $items = array();

  $data = form_data($form_state);

  // FOR LIST VIEW TEMPLATES
  $items['data'] = webservice($data);

  //FOR OTHER TEMPLATES (TABLE-VIEW)
  if(isset($_SESSION['data_view'])){
    unset($_SESSION['data_view']);
  }

  $_SESSION['data_view'] = $items['data'];

  return theme('list_view',  $items);
}


texts: Module Uninstall Validators and Lazy Services

texts:
I have recently been working on creating functionality for a module that requires certain content related to the module be deleted before the module itself can be uninstalled.
https://www.drupal.org/project/commerce_pos/issues/3006353

I used an example for core's book module where I saw that a service called module_install.uninstall_validator and a ProxyClass called BookUninstallValidator were used in order to implement functionality similar to what I was attempting to achieve.

My question is thus: why is the module_install.uninstall_validator set to lazy and what exactly is a proxy class?

I have searched in the documentation but have been unable to find any useful explanation; so any here or links to such pages would be much appreciated.


texts:
I am developing custom module in D7. And created one custom block. And how can show the conent in the block as pop up box?sample block code is  `

  $block['content'] = t('Test message');

I want show 'Test message' as in pop up..

`


texts: Menus - hard coded primary nav with per-page sub nav

texts:
My primary navigation is hard coded (it has to be; graphical purposes).

Firstly, how can I tell which one is "active" (current page)?

Secondly, based upon which one is active, how can I show child links of that link in the sidebar? I've thought of a possibility, but it would require creating tons of blocks for the menus and then only enabling them on their parent page. This seems like a lot of work for something that a module should take care of.

I've found http://drupal.org/project/menu_block which looks promising, but I'm not clear how to use it in my situation.

I prefer to have total control of how the menus will look (a custom .tpl file)


texts: Drupal Commerce AJAX HTTP Error 200 while adding product display

texts:
has anyone else come across this?  I'm getting an error when I'm trying to create a product display.  It happens when I'm trying to put in the product SKU.

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: http://hayfield.com:8082/commerce_product/autocomplete/node/field_product/product_display
StatusText: OK
ResponseText: {"glorious_dream":"\u003Cdiv class=\u0022reference-autocomplete\u0022\u003Eglorious_dream: Glorious Dream\u003C\u002Fdiv\u003E", "Hayfield_Elegance":"\u003Cdiv class=\u0022reference-autocomplete\u0022\u003EHayfield_Elegance: Hayfield Elegance\u003C\u002Fdiv\u003E"}jQuery.extend(Drupal.settings, {"thmr_1":{"id":"thmr_1", "name":"link", "used":"theme_link", "type":"func", "duration":2.78, "candidates":[ "hayfield_link" ], "preprocessors":[  ], "processors":[  ]}, "request_id":"1852760308506e2eabeea31", "devel_themer_uri":"\u002Fdevel_themer\u002Fvariables\u002F1852760308506e2eabeea31"});

Thanks in advance!!


texts: How do I set a condition to only show a block to members of a group?

texts: I use the Drupal Group module. Is there a way to check if a logged-in user is an groupmember or not when the user visits the grouppage? I have some blocks that should be hidden if an user is not a member.


texts:
Basically I want to be able to have a user be able to specify a title for a long text and summary field. Functionality being that you could have this with only one field:

day 1: doing something
this is what we did on day 1

day 2: doing something on day 2
this is what we did on day 2

Basically I want one field input for my content type creation form that correlates a title and the paragraph to go with it. I thought of a shoddy way to do it by creating a separate content type and bringing in the copy with a views block but I feel like there should be a much simpler way to allow a user to input a title to attach to a long text and summary field.


texts: Updating core with Composer, differences, and why --with-dependencies fails

texts:
I'm a Drupal novice and have been playing around with it for the last few months. It seems like every 'how-to' article tells you a different way and a reason not to do it the other way.
I am a sysadmin for some developers and don't plan on getting too far in over my head but want to successfully support Drupal with Core and Module updates as needed for security.
I set up some Drupal instances on a test vm and have some questions here with my guesses on the answers and would appreciate confirmation and perhaps a little guidance.
Recently I installed Drupal 8 using Composer with the below command and it installed 8.8.5:
composer create-project drupal/recommended-project

composer.json has this:
"drupal/core-composer-scaffold": "^8.8",
"drupal/core-recommended": "^8.8",

(Q1) Later I ran this and it didn’t update Core at all despite 8.9.5 being available:
composer update drupal/core-recommended –with-dependencies

(A1) I assume this is because drupal/core-recommended has dependencies that aren’t updated by this command so it didn't update anything. I don't get why the "with dependencies" flag didn't force it to update them though.
(Q2) I reverted to a vm snapshot back to 8.8.5 and tried this and it updated Core to 8.8.8:
composer update drupal/*

(A2) I assume because Core >8.8.8 has unmet dependencies so it stopped at 8.8.8.
(Q3) I reverted back to the 8.8.5 snapshot and tried this and it updated Core to 8.9.5:
composer update

(A3) because this updates everything along with all dependencies, but how is this different from Q1 above?
This says a workaround for the dependency problem is to specify each dependency along with Core. (eg: composer update drupal/core "symfony/*" --with-dependencies).   There are a number of dependencies showing as ‘prohibits’ so this would be a pretty long command. So why do it this way and not just use “composer update”? Isn't it more or less the same thing?
I'm guessing it really depends on each use case but what is the general best practice? I don't expect our Drupal instance to have a lot of modules because I'm told the developers plan on doing a lot of the work on the front end.


texts: how to render a field "view mode" inside a field collection item template file?

texts:
to render a field "view mode" (or "format") inside a node.tpl.php i use, for example:

<?php
     print render(field_view_field('node', $node, 'field_myfieldname', array(
        'label'=>'hidden',
        'type' => 'text_summary_or_trimmed',
        'settings'=>array('trim_length' => 30),
    )));
?>

now i'd like to do quite the same thing, but inside a field-collection-item.tpl.php (for a field that is part of a field collection).

in my field-collection-item.tpl.php, i can render each field just like in a node;tpl.php:

<?php print render($content['field_myfieldname']); ?>

but if i try the first code above inside field-collection-item.tpl.php (to trim a field-collection field), it just doesn't work...

thanks you for helping !


texts:
I am working on an Equipment Checkout system using Drupal 7, MERCI, views, panels, rules, and many other modules. I am working for a community college in Oregon. I am upgrading features on an already running system that was built by myself with the help of a few other people last year. The system is offline for the summer.

One of the features that I am trying to implement is that when we pull up a customer account, we also see content related to the customer blog posts, reservations, and some custom content types.

I have created a block called 'Customer History' on the customer view for the information to be displayed.

So now I need to figure out how to get the content into that block.

I'm thinking that I could somehow do a search for the customers name and display results in the block. What do you think? Is this a good way to go?

Any help would be great thank you.


texts: How do I alter a database schema defined from another module?

texts:
Since hook_schema_alter() was removed from Drupal 8, how do I alter any existing schema defined from another module in Drupal 8?

I have used mymodule_update_8201 (hook_update_N()) in my .install file, but no new field or column gets added into my existing table. Is there any other way to achieve this?

This is the code for the first module (a.install).

function a_schema() {
  $schema['my_table'] = array(
    'fields' => array(
       'type' => array(
          'description' => 'registration type',
          'type' => 'varchar',
          'length' => 255,
        ),
     ),
  );
}

This is the code for the second module (b.install).

/**
 * Implements  hook_update_N().
 */
    function b_update_8201() {
     $spec = array(
        'type' => 'varchar',
        'description' => "New Col",
        'length' => 20,
        'not null' => FALSE,
      );
     $schema = Database::getConnection()->schema();
     $schema->addField('my_table', 'newcol', $spec);
     return $schema;
    }


texts: My site can't display any images (logo, article's image) all type of images.


texts:
I'm using CKeditor as the Wysiwyg container. I configured it to show the full toolbar but when the user tries to edit it does not show the buttons configured.
I'm using the last version of the module available for drupal 7 and jquery 1.7.
Some buttons as iframe or letter size are not showing up.
What can I do to solve this.
Best regards
Eduardo


texts: Drupal views table with multiple agregation


texts: Dynamic view with a field matching a role of User in Drupal 7

texts:
On my site, the nodes are restricted based on user's role. Admin selects any number of roles in a field (field_role) when creating a node and if any logged in user's role matches one of the selected roles, he/she can access the node.

But this only works, when user clicks on the node and then either can see the node or see an access denied warning.

The problem is that I just don't wanna show the node, if the access is restricted. The nodes are shown through a view as a listing on home page and I am just not sure how to tell the view that if the logged in user doesn't have any of the role selected in  "field_role", then filter out the node from the listing.

Any help.


texts: I have a user manual in my site using Drupal 6, Which was created using book module. I use CKEditor as the editor and I want to upload images between the paragraphs. CKeditor asks for url to upload images.


texts:
We have to build a multi lingual site(English and Spanish). There are 2 approaches to enable multi lingual site

Single site with i18n module

Content,Functionality and layout are almost same for both languages

Multi site (Parent English Site and Spanish sub site separate)

Content,Functionality and layout are mostly different for Spanish site
Parallel Enhancement needs to be done for both languages
English language site needs to be redesigned without affection Spanish language site

We are preferring to choose the second approach to build the multilingual site. Please feel free to recommend the Implementation approach using i18n module.


texts:
This is almost 6000 rows of taxonomy terms ranging over 8 columns that i'd like to import from csv. I would like to use it for facet search.

The CSV is located here (google_product_category).

The format is like:

# Google_Product_Taxonomy_Version: 2015-02-19
1 - Animals & Pet Supplies
3237 - Animals & Pet Supplies > Live Animals
2 - Animals & Pet Supplies > Pet Supplies
3 - Animals & Pet Supplies > Pet Supplies > Bird Supplies
7385 - Animals & Pet Supplies > Pet Supplies > Bird Supplies > Bird Cage Accessories


texts: Local action on node but path a child of node?

texts:
I have created two local actions which I want to display on my nodes, General Configuration and Advanced Configuration.
General Configuration will show at node/%node, but Advanced Configuration is showing at node/%node/config. Is there anyway to keep the path as node/%node/config/advanced but have the local action display on node/%node?
  $items['node/%node/config'] = array(
    'title' => 'General Configuration',
    'type' => MENU_LOCAL_ACTION,
  );
  $items['node/%node/config/advanced'] = array(
    'title' => 'Advanced Configuation',
    'type' => MENU_LOCAL_ACTION,
    'weight' => 2,
  );

Thanks for any help


texts:
I have used editable views module to get a single page to edit the nodes. I want to store the updated details to an external table.

I have used hook_node_update but it only saves the first node's value to my external table not the rest of nodes(I have 18 nodes in a single page to edit).

function pmr_data_table_node_update($node) {

  if($node->type == 'upload_data'){
    $node_id = $node->nid;
    $profit = $node->field1['und'][0]['value'];
    $satisfaction = $node->field2['und'][0]['value'];
    $from = $node->field3['und'][0]['value'];
    $to = $node->field3['und'][0]['value2'];

    $newDate = date("Y-m-d H:i:s", strtotime($to));

    $entry = db_update('table_name')
     ->fields(array(
     'profitability' => $profit,
     'customer_satisfaction' => $satisfaction,
     ))
     ->condition('nid', $node_id, '=')
     ->condition('to_date', $newDate, '=')
     ->execute();
    drupal_set_message('Data updated successfully.');

  }

}

The above code only saves the first node in the editable view list. Can anybody suggest how can I save all the field values in a single round? Is there any hook where I can use to save the all the changed field values to the external table?

OR

Is there any hook by which I could get the data just after the set of nodes are updated?


texts:
I have a view with BEF which is generating a criteria box like this below

I have no clue where this $ sign is coming from and how to remove it or change it.

Update

I investigated further and what I have noticed is that the currency symbol is linked to the theme settings. There is a field in the theme settings to accept currency code which was by default EUR. That I changed to INR which is not working but when I change to JPY it shows proper japan yet currency symbol. This confirms that this is the place where we need to look at.

Can some one help me where to start from?


texts: Is there a way to create custom node types which will never have a page

texts:
I'm working on several projects where we use custom node types (because they're easy to add fields to, edit, show in views, etc), but there are certain node types I wouldn't want to expose at all in the form of pages, i.e. purely internal (maybe they can be viewed in blocks, at most).

What's the best way to accomplish this?

I am using Drupal 7.


texts: replace css on certain pages by another css

texts: I use drupal 6. How do I remove global.css from certain path like cart* and replace it with another css? I can add for example stylesheets[all][] = custom.css inside my theme info file but how to load it only on path cart*  and how to disable global.css on the same path? Thank you


texts: After updating to user_restrictions-7.x-1.0 in drupal7, I can no longer run cron from another host

texts:
I've been updating several drupal7 installations from one browser on the same host as ONE of them.  I just did this, updating to user_restrictions-7.x-1.0 on both machines.  This caused no problems on the host where my browser was running, but on the other host drupal will no longer run cron manually at my request, and clicking on the "To run cron from outside the site, go to http:///drupal/cron.php?cron_key=..." link yields an "Access Denied" message.

Under the circumstances, I must conclude that something significant has changed in user_restrictions-7.x-1.0 that enforces some exclusion on the basis of IP address that didn't exist before or was not previously being enforced.

How do I grant my other host permission to use the cron_key in question?


texts: Get admin menu to show features that a role has permission to

texts:
I have a few client roles I have created.  They have permissions around creating and editing content mostly.  In the admin, their menu is small -- clicking Manage only provides Content.  This works well.  However, I have tried to also grant one role permissions to manage webforms and entityqueue.  These pages are under the Manage > Structure menu.  I can't seem to get the menu to show to allow access to Manage > Structure > webforms or Manage > Structure > entity queue.

Is there a permission I am missing to get these to show in the menu?


texts: Saving file to drupal site using drupalgap

texts:
I am trying to save an image from Android emulator to a Drupal site using DrupalGap, but I am unable to do this.  This is my ajax call which I wrote to save the data to drupal site.

My click function

   $('#page_node_create_submit').on('click',function(){

try {
      var title = $('#page_node_title').val();
      if (!title) { alert('Please enter a title.'); return false; }

      var body = $('#page_node_body').val();
      if (!body) { alert('Please enter a body.'); return false; }

      var filef = $('#page_node_filef').val();
      if (!filef) { alert('Please select file.'); return false; }

     //var datastring = 'node[type]=drupalgap&node[title]=' + encodeURIComponent(title) + '&node[language]=und&node[body][und][0][value]=' + encodeURIComponent(body) + '&node[files][field_filef_und_0]=' + '&fid=47' + '&uid=1';
     //alert(datastring);
     //return false;

      $.ajax({
          url:"http://192.168.1.146/drunew/?q=services/session/token",
          type:"get",
          dataType:"text",
          error:function (jqXHR, textStatus, errorThrown) {
            alert(errorThrown);
          },
          success: function (token) {
          // BEGIN: drupal services node create login (warning: don't use https if you don't have ssl setup)
          $.ajax({
              url: "http://192.168.1.146/drunew/?q=my_services/node.json",
              type: 'post',
              data: 'node[type]=drupalgap&node[title]=' + encodeURIComponent(title) + '&node[language]=und&node[body][und][0][value]=' + encodeURIComponent(body) + '&node[files][field_filef_und_0]=' + encodeURIComponent(filef),
              dataType: 'json',
              beforeSend: function (request) {
                        request.setRequestHeader("X-CSRF-Token", token);
                     },
              error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert('page_node_create_submit - failed to login');
                console.log(JSON.stringify(XMLHttpRequest));
                console.log(JSON.stringify(textStatus));
                console.log(JSON.stringify(errorThrown));
              },
              success: function (data) {

               $.mobile.changePage("main.html", "slideup");
              }
          });
          // END: drupal services node create
          }
        });
    }catch (error) { alert("page_dashboard - " + error); }
return false;

});

But the above code is not working for file field, then after doing some R&D I got to know that first we have to get the fid, then save it.

Below is the respone after creating the fid for the image.

{"fid":"47","uri":"http://192.168.1.146/drunew/my_services/file/47"}

Here my doubt is how can I integrate this response in my above ajax call to save the image in drupal site.

Any help, thanks..


texts: Change system.404 path dynamically based on context

texts:
I have a site that makes use of the groups module to denote various locations all with their own content.

I'd like to give the ability to programmatically alter the system.404 path depending on the context for each group, to arbitrarily chosen content within the group's content.

I'm not finding a lot of documentation which would point me in the right direction.  Has anyone done this before and can point me in the right direction?


texts:
We are planning to implement custom features (in the form of newly developed modules) on top of a standard Drupal7 installation. This "standard" Drupal installation may include some contribution modules such as organic groups.
This extended Drupal installation will be provided to different clients each of which may require custom theming and some (minor) customisation of the custom features mentioned above.

What I am wondering about is the deployment and code maintenance architecture.
Coming from an object oriented background my initial reaction was to propose a layered architecture along these lines:

------------------------
Client Customization Modules
----^ ^ ^ ^ ^ ^ ^ ^-----
Generic Self-created Modules
----^ ^ ^ ^ ^ ^ ^ ^-----
  Contribution Modules
----^ ^ ^ ^ ^ ^ ^ ^-----
      Drupal Core
------------------------

Meaning the custom main extension modules ("Self-created Modules") would be overwritten/overloaded wherever the respective client requires individual changes using a second custom layer of "Client Customization Modules".
From my point of view this is benefitial as it allows for the generic "Self-created Modules" to remain identical for all clients so bugfixes can easily be performed on a single, central svn location.

Now a colleague argued heavly against such an approach, saying having a 4th module layer which basically overwrites hooks of the 3rd layer would be extremely bad practice in Drupal development as it raises the application complexity and makes debugging virtually impossible.

The alternative would be to create redundant copies of the "Generic Self-created Modules" layer for each client and directly customize these instances. While this is surely possible, a bugfix or change to the generic functionality would then not be possible anymore in a central location, so this approach seems quite dirty to me.

Is it really considered bad practice, or heavily advised against, to customize ones own custom modules by "hooking custom hooks" in a way proposed above?


texts: How to add newsletter functionality (just stable modules if possible)?

texts:
I've searched a little and I needed to add newsletter functionality to a Drupal 7 installation. I've found Simplenews, which is in Beta version for Drupal 7 nothing more. I don't need anything really complicated, just these functionalities:

Guest user can subscribe to newsletter by leaving their email address in a field
Registered users can tick a checkbox in their profile to choose whether to receive newsletters
Users can unsubscribe from newsletter by clicking a link in the newsletter
A WYSIWYG editor for sending newsletters (but, I think this can be accomplished with the WYSIWYG module)

nothing more. If any of you tried the development version of Simplenews, please provide your experience.


texts: Field Collection values in json data document view

texts:
I am wondering if I am hitting the limits of what can be done with the json data document view for displaying output and whether I need to just write my own module or use php's json_encode to do this.

Essentially I have a content type called 'projects' and I have created several views that output json data so that I can use them within the angularjs frontend I am embedding into my Drupal 7 site.

On 'projects' there is a field collections field for 'team'. This consists of a node reference to a 'person' and a text-field for 'role'.

I can use a relationship in my view to access the field-collection items but I am currently stuck as the field delta (which I have set to 'all', since I want to see all associated team members for a project'). This is causing the json view to duplicate each project many times over when there are multiple team members, and also I am not able to get the node reference for the team member.

Is this something that is possible to do with views/json? Or should I just hack up my own json from within the page template or a module using PHP?

Thanks
- J


texts: Update webform status on load and update

texts:
I have a Drupal 6 website that uses webform-enabled node to allow users to signup to events. The site is multilingual and can only set submission limit per language. On page load and on webform submit, I want to count all submissions from all language and if the total is greater than a certain limit, I want to programmatically set the webform status to "closed".

Which Drupal hook should I use here? I tried hook_form_alter() but it only happens before the form is rendered, and will only display (or not display) the webform after a second reload. Also tried hook_nodeapi() where $op = 'load' but at this point the webform isn't attached to the node so I can't manipulate the data.

Please help.


texts: How to include a caption (a cck field) in lightbox?

texts:
I'm working on a theme i bought and since i'm just learning php i'm having a hard time including a field as a description text in the lightbox once the thumbnail is clicked.

Here's the code (that's in the tpl.php file) that outputs the thumbnails (from a view)

<?php
if (isset($fields['field_image']->content) and strpos($fields['field_image']->content, '<img')) {
 print str_replace('<a ', 'content); ...
?>

Here's the html version of the lightbox script :

<img ...

How can in include the caption tag ?

Thanks !!


texts: How to display fields from different entities in views

texts:
In my project, i need to create a view that displays fields created in the profile 2 module and a field from the core registration form (Username) in the same table. Please how can this be done? I plan to filter users using the username field. and other values provided via the profile 2 fields.

Thank you.


texts: How to implement a nomination process for nodes?

texts:
I want to implement a nomination process. Users should be able to

Nominate existing Nodes of type 'course'.
Nominate new content that should later be of type 'course'.

All nominations should be listed somewhere.

What's the best way to do this?

For 1. I thought about using the Flag module and then just make a view where all nodes with nomination flag are listed.

For 2. I'm not sure, maybe I use webforms and the admin has to transfer it into a node of type 'course'. But how do I get a list of new AND existing nominated content?


texts: Display node's details instead of ID with relation module

texts:
I have create Two node ‘Partners’ & ‘Project form’.

I used relation module & create directional relation between two nodes.

Partner’s node have following fields:

I have to select multiple partners in Project form, so I added relation widget into project form for create relation with partner’s node. Currently that field’s display partners node id as per below screenshot:

Instead of that I want to display partner’s details like (partner name-dept-country-city) & also allow to search using same string as per below screen-shot:


texts:
Assuming I have two distinct entities A and B, with B having an Entity Reference field to A, how can I associate other data (=other fields) with the Entity Reference?

For example, assume that A is "Political parties" and B "Politicians", and I'd like to store a date range field for the politician's membership in said party.


texts: Show custom query page based on user logged in

texts:
I want to make a customized query page based on the user who is logged in. The query page is a node made in custom made content type "query"(this content type has no additional fields than which are created in a new default content type)

I have a <p id = my_para> tag in my node. I call an external query.js script in my node which uses xmlHTTPRequest to call an external query.php. This php connects with mysql and does a query like

select * from my_table where user = "logged-in-user";

and returns the query result using json_encode back to query.js. The query.js parses json and displays it on my node using document.getElementById("my_para").innerHTML = my_parsed_json_variable

So I some how want to get the logged in user details(there can be many logged in users to mysite at the same time) so that each user can see a custom page through these scripts.

How can I get the user details in my external query.php ?
I tried using these in my query.php

global $user;
$name = $user->name;
$id = $user->uid;

But it gives

  Trying to get property of non-object in
  C:\xampp\htdocs\mywebsite\sites\all\themes\danland\query.php


texts:
We are using this module for our redirection for 404's and manually created redirects.
The site has a number of pages translated for the American audience. We added a redirect today for a page and simply pointed the redirect url to <front>. The referring URL is http://www.example.com/when-to-go/october. In the General site settings, the front page is set to /homepage. (A Basic page for this exists.)

Now when going to http://www.example.com/when-to-go/october, the users are redirected to http://www.example.com/en-us which gives a The page isn't redirecting properly error.

There are two issues:

It should simply send users to /homepage, which is what is set to
If we wanted the American version, then it should use en-US not en-us; Drupal seems to be treating this as case sensitive


texts:
I can't get the comment form to appear in my theme.  It does appear in Garland, but not in Bartik.

I have copied node.tpl.php and comment.tpl.php into my theme from Garland.

I have added text to the node.tpl.php template to ensure that it is in fact the relevant template for the node.

I checked the page source to see if perhaps the comment form is appearing, but is hidden by CSS.

I deleted ALL code from the template.php file in the theme.

I have cleared the cache and run cron after doing all of the above.

I've built more than 100 Drupal sites, so I'm not exactly new to the framework.  And yet I can't get the comment form to appear in this theme.

Clearly I must be doing something wrong, but I can't think of what else to check.

Any ideas?

Remember, the comment box does appear in Garland, so this can't be a permissions issue and can't be due to settings in the node itself.

The Drupal version is 7.41.

Thank you.


texts: how to set up a user field that the only the administrator can access?

texts:
I would like to have a STATUS field for certified and uncertified for all users under a certain role preferably, but it could be for all users

how would i go about implementing this?  thanks!


texts:
How do I configure xmlrpc_server?

I am using the Service module, and I need xmlrpc_server. I installed, and enabled it, and it is showing me the following error:

  xmlrpc_server has no settings
  The server doesn't have any settings that needs to be configured.


texts: geofield and leaflet maps: how to show proximity-originator on map?

texts:
My Goal:
Show a hotel on a map, together with nearby restaurants.

Currently, i have only a table, based on a view with the hotel's node-id as contextual filter.
Now i'd like to put all that in a map.

I think with OpenLayers i could show the hotel in one layer, and the restaurants in another.
But i'd prefer leaflet for it's size, so i did not try Openlayers yet.

Using geofield, i saw there is a proximity-filed in views.
With that, i can show the restaurants and have the proximity in the tooltip, but i can't show the Hotel.
My case would be an "abuse" of the proximity field, but i guess there would be more reasonable use-cases, which could use such a feature.

I also thought about how to do a view that contains hotel x and all all referenced restaurants, but i did not find a way yet.
Restaurants and Hotels are nodes, with hotels having a multivalue entity-reference field pointing to the recommended restaurants.


texts: Checkout page not found when order created through Drupal Commerce API for not authenticated (anonymous) user

texts:
I have the following code inside rules - action (being triggered by webform submission)

<?php
global $user;
$product_id = 1;

// Create the new order in checkout; you might also check first to
// see if your user already has an order to use instead of a new one.
$order = commerce_order_new($user->uid , 'checkout_checkout');

// Save the order to get its ID.
commerce_order_save($order);

// Load whatever product represents the item the customer will be
// paying for and create a line item for it.
$product = commerce_product_load($product_id);
$line_item = commerce_product_line_item_new($product, 1, $order->order_id);

// Save the line item to get its ID.
commerce_line_item_save($line_item);

// Add the line item to the order using fago's rockin' wrapper.
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$order_wrapper->commerce_line_items[] = $line_item;

// Save the order again to update its line item reference field.
commerce_order_save($order);

// Redirect to the order's checkout form. Obviously, if this were a
// form submit handler, you'd just set $form_state['redirect'].
drupal_goto('checkout/' . $order->order_id);
?>

the code works perfectly when i am logedin, however when i submit the webform as not authenticated user, i get sent to checkout/12, I get page not found.

there is no errors in the log, and i see in the backend that the order was created... please help...


texts: Services Views module no longer maintaines. What are my options?

texts: My site relies heavily on the Services and Services Views modules. The Services Views module is no longer being maintained and it has a security vulnerability in it. Could someone help me either identify what the security vulnerability is. Or point me to a decent alternative module?


texts: Drupal views filter exposed with condition fields

texts:
I have a page about buying/selling the car, on the views I have filter with by exposed function. My expected is, when I select the first category, the hidden sub level 1 category should be visible then the User can select level 1 category, we continue show the level 2. Then we make the filter with this filter.

For ex.

All Categories
Used Cars for Sale
Motorcycles
Boats

[Selected [Used Cars for Sale]:

Acura
Honda
Toyota
Huynhdai...]

[Selected [Motorcycles]

Cruiser/Chopper
Off-Road/Dual Purpose
Sport Bike]

Select All Categories with Used Cars for Sale, 1 should show and 2 show invisible, select Motorcycles 1 should invisible and 2 should visible, and so on.

Click Filter, it should filter the current views.

It should be customize with the text, the range slide, the checkboxs... So what is the best modules or best way that I can do with the Views module?

Looking for somebody help me the solution

Kind regards,
John


texts: How to best store and expose external route based location data for use in views/charts/openlayers?

texts:
I have a large amount of different route data (hundreds of thousands of different location pairs per week and some accompanying data for each pair such as datetime, speed, direction) that I am parsing from raw data files (that are added as files/nodes using REST services) into a mysql db currently, with the plan of exposing this data to views for use in charts and openlayers etc. However, I am wondering if this is the best method and whether I would be better off parsing the data into a different storage system.

What would be your storage method of choice in this scenario? What storage would offer the best read times into views for mapping out large trips containing thousands of data points?


texts: Output different menus based on site section (URL)

texts:
I'm working on a Drupal 8 site that's divided up into sections that correspond to projects. So URL aliases will be /project-a/some-content, /project-b/some-content, etc.

I'd like to support creating menus—for each section—in the admin, and to render those in the primary navigation region based on which section you're in.

My assumption is that somewhere I need a switch statement that uses URL segment 1 for case and specifies a configured menu to load for each case, or a default.

Is this the best approach? Where would I do that, if so?


texts: Best practice for third-party PHP class-based library

texts:
I am currently working on a module that requires a third-party PHP library, which is essentially a single PHP class.  Normally, I would place it in an includes/ subdirectory and add

files[] = includes/Foo.php

to my .info file and let the Drupal 7 class auto loader do its thing when I do a  $foo = new Foo().

I have permission, though, to release this module to the public and would rather not include the library with the module.  I am well aware about the complications regarding licensing, but for the sake of this question, I would like to ignore it.

There is a similar question, How do I include a PHP library?, but I don't really think this answers my dilema.

This answers to this question essentially say to use the Libraries API, but every single module that I have found that uses this just does alibraries_get_path() to get the basepath (and includes fallback path when it isn't available) and then does a require or include with some error checking (or not).  All do something like:

if (!class_exists('Foo')) {
  $path = function_exists('libraries_get_path') ?
    libraries_get_path('foo') : 'sites/all/libraries/foo';
  if (!include($path . '/Foo.php')) {
      // handle this error
  }
}

In this case, the Libraries API isn't really doing anything.  I don't see the advantage to using this, over the old method of asking users to download a copy and place it in the module folder itself.  And, there is still the issue that the module developer still needs to manually do the load with include/require.  For example, the Facebook module just loads the library in a hook_init and the HTML Purifier module has an internal function to check-and-load every time the library is needed.

This may be a widespread practice, but it doesn't seem like a best practice.

Should my module take the initiative and declare a hook_libraries_info so I can use libraries_load('foo')?  This, too, seems odd.


texts: Check session if session expires,redirect them to particular page

texts: I have two types of users,authenticated users and anonymous users.It would be helpful if i could redirect a logged-in user to the login page once the session has expires.Now what i have is that, i stay at the same page which is a bit of confidential type of page.So i would like to check if session exists after a particular time period if possible and redirect the user if the session expires..


texts: hook_form_user_register_form_alter() does not customize user registration form

texts:
I have implemented a hook_form_user_register_form_alter().

function hook_form_user_register_form_alter($form, $form_state, $form_id) {
  $form['account']['name']['#description'] = 'This is your login name. It will be displayed on the forums and in comments. This is not your billing information. Spaces are allowed; punctuation is not allowed except for periods, hyphens, apostrophes, and underscores.';
  $form['actions']['submit']['#value'] = 'Continue to subscription and payment page.';
  $form['#submit'][] = 'custom_user_register_submit';

  dpm($form);
}

When I use the registration page, I get mixed results. First of all, my custom_user_register_submit() function is called when I click the submit button. This is correct.

However, I get no changes to the form elements printed on the user registration page. For example, but button should have custom text. It does not; it uses the default text 'create new account'. Strangely, in the output from my dpm(), the values in those array elements match my custom code! So, it looks like my hook is implemented correctly and the form elements are being changed, but later in the Drupal bootstrap, they are overridden again and brought back to their defaults.

Anybody know a solution?


texts:
Is there a Drupal way to use AJAX to check if new content has been created, and then reload the view if there is new content?

I think Drupal.settings() or Drupal.behaviors() may be where I need to go but am curious if anyone has done this before.

Basically we have a View that is a feed of a bunch of nodes from different content types that sits on a display in our office. We have a cron job that pulls in new content from the different feeds that create the content and creates nodes. When this new content is created, I want the view to update via Ajax.

Thanks :)


texts: How do I get $view->the actual row number?

texts:
How do I get the actual rows number in views-view-field--title.tpl.php in Drupal7 and views3?

I know how to get the total by

$view = views_get_current_view();
$view->total_rows;

But how do I get the actual row number? To print
1/4
2/4
3/4
4/4


texts: How can I pass the filter parameters of one view to a different view on the same page?

texts:
Summary

I have two seperate views on the same page - one Page and one Block that show two seperate content types respectively, but have a filter exposed for a field that they share.

On the page of the first view, I have attached a block display of the second into a new region. I want the filter values of the exposed filter of the first view to also feed into the filter values of the second block view, if possible.

How it's currently set up

I have two views.

The first view, "Local branches", is a Page display that surfaces content of type Local branch. This content type has a Location field, powered by the Location module. On the view page, there is an exposed filter criteria:

Location: Distance / Proximity

which is exposed to the user as a text field and the origin in the filter settings set to Postal Code.

The code is then sorted by Distance / Proximity.

On the view page therefore, there is a text field where users can enter in a post code and it will return results closest to that Postal code.

The second view, "Shops", is a Block display that surfaces content of type "Shops". This content type is almost identical to the "Local branch" content type, in that it also has a Location field.

In this view, I have again an exposed filter:

Location: Distance / Proximity

that is set up the exact same way - but note that this is a Block display. It's again sorted by Distance / Proximity.

Finally, on the Page of the first view, "Local branches", I have placed the second view's Block, "Shops" in a seperate region.

My hope is that the Shops block will somehow pick up the exposed filter settings from the URL built by the "Local branches" view, which looks like this:

http://www.example.com/local-support?distance[postal_code]=EN11+8RX&distance[search_distance]=100&distance[search_units]=mile

As you can see there are three parameters that power the exposed Postal code search form. Here's a crude diagram:

Problem

The Block view, "Shops", doesn't respond to the filter values in the URL, but just outputs all results sorted arbitrarily (there is no other sort atm). I would like it to respond with results as if it were using the exposed filter values from the "Local branches" view as its own exposed filter.

Potential solutions and queries

One thing I did try was to programatically create the "Shops" block, and render it on the view page /local-support and see if I could use the $_GET parameters and feed it directly in to the view. Code to generate the output looks something like this:

function _mymodule_shop_block_view() {
  $view = views_get_view('shops');
  $view->set_display("block_1");
  $view->set_arguments($args);
  $view->pre_execute();
  $view->execute();
  $content = $view->render();

  return $content;
}

The problem is I'm not sure what the value of $args would actually be in this case. I want to exectue and render the view, but pass the $_GET params in somehow, but they're exposed filter params so I don't know if $view->set_arguments is actually appropriate in this case?

My other thought that was because the "Shops" view is a Block display, the exposed filter won't work as it should. Could I try building it as a page display, expose it the Location filter as a block, and then rendering it in a block? I could hide the exposed filter in CSS (bad I know but if you haven't guessed by now I kinda wanna get this working).

Could attaching the block to the Page view integrate it - is it possible to do view attachements across separate views?

Thanks for taking the time to read this - I hope there's enough info about what I am trying to achieve!


texts:
How can I include the text between the label of image field and the upload button?
How can I remove the text "maximum file size" of the image field in some content types? I want to remove the text "maximum file size" but I want to keep "allowed extensions."


texts: How to delete a database field named as a reserved word?

texts:
I want to drop a field from db table which is named as read.
I tried like;

db_drop_field('my_table', 'read');
db_drop_field('my_table', '`read`');
db_drop_field('my_table', `read`);

None of these work.


texts:
I want to create some menu items, i have code for it

   $item = array(
  'link_path' => 'guarantee/validto' ,
  'link_title' => "meeeeeeeeeeeeeeeeeeeeeeeeeeeeeenu",
  'plid' => 0,
  'hidden' => 1,
        'weight' => 0,
        'menu_name' => 'main-menu',
        'module' => 'guarantee',
   );
   menu_link_save($item);

But nowhere i can find where i should place this part of code. Can someone could suggest me where to place it to create manu items? I have my moudle enabled/installed and i need to create 10 menu items like above. What will be the best solution?
is


texts:
I've seen other questions related to this require_once error but none seemed to have cleared the issue for me.  I'm getting the error

  Fatal error: require_once(): Failed opening required '/var/www/html/sites/default/files/css/css_ameo32TxJT0SmdjsT3Q3NttK5wvcUqA.css.gz' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/includes/bootstrap.inc on line 3179.

The gzipped file doesn't exist, and when I've tried to simply rename other files to fix the error I've had no luck.  Any help would be appreciated. Also here is the code including line 3179  - require_once DRUPAL_ROOT . '/' . $file;

 if ($file) {
require_once DRUPAL_ROOT . '/' . $file;
return TRUE;
  }
  else {
    return FALSE;
  }
}


texts: why "errors validating the config synchronization" when UUID's match?

texts:
I'm moving a d8 config from dev to stage and I have edited system.site so that the primary UUID on the stage system is identical to the dev system; and yet drush still reports: "There were errors validating the config synchronization."

This is an initial import; so it wants to replace almost all the objects on the stage site with objects from dev which differ only by UUID. There is almost no data (just site name, etc.) This used to work fine under 8.0.0-beta12; but I recently updated to 8.0.0-beta15 (which may or may not be significant). I'm using drush tag 8.0.0-beta14.

# grep uuid configs/from_dev/system.site.yml
uuid: c3b4a4a7-e8ab-44d2-b349-73dc5a8dea63
# drush8 @iron.stage cget system.site | grep uuid
uuid: c3b4a4a7-e8ab-44d2-b349-73dc5a8dea63
#

I checked the whitespace and rebuilt the cache.

# drush8 @iron.stage cim from_dev
 Collection  Config                                                Operation
             system.menu.account                                   create
             block.block.bartik_breadcrumbs                        create
             block.block.bartik_content                            create

       blah.. blah.. blah..

             block.block.bartik_breadcrumbs                        delete
             system.menu.account                                   delete
Import the listed configuration changes? (y/n): y
exception 'Drupal\Core\Config\ConfigImporterException' with message      [error]
'There were errors validating the config synchronization.' in
/usr/local/www/d8_iron_stage/d8/core/lib/Drupal/Core/Config/ConfigImporter.php:730
Stack trace:
#0
/usr/local/www/d8_iron_stage/d8/core/lib/Drupal/Core/Config/ConfigImporter.php(517):
Drupal\Core\Config\ConfigImporter->validate()
#1
/usr/local/www/d8_iron_stage/d8/core/lib/Drupal/Core/Config/ConfigImporter.php(464):
Drupal\Core\Config\ConfigImporter->initialize()
#2 /usr/local/src/drush/commands/core/config.drush.inc(622):
Drupal\Core\Config\ConfigImporter->import()
#3 /usr/local/src/drush/includes/drush.inc(719):
_drush_config_import(Object(Drupal\Core\Config\StorageComparer))
#4 /usr/local/src/drush/includes/drush.inc(705):
drush_call_user_func_array('_drush_config_i...', Array)
#5 /usr/local/src/drush/commands/core/config.drush.inc(600):
drush_op('_drush_config_i...',
Object(Drupal\Core\Config\StorageComparer))
#6 [internal function]: drush_config_import('from_dev')
#7 /usr/local/src/drush/includes/command.inc(359):
call_user_func_array('drush_config_im...', Array)
#8 /usr/local/src/drush/includes/command.inc(210):
_drush_invoke_hooks(Array, Array)
#9 [internal function]: drush_command('from_dev')
#10 /usr/local/src/drush/includes/command.inc(178):
call_user_func_array('drush_command', Array)
#11 /usr/local/src/drush/lib/Drush/Boot/BaseBoot.php(62):
drush_dispatch(Array)
#12 /usr/local/src/drush/drush.php(70):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#13 /usr/local/src/drush/drush.php(11): drush_main()
#14 {main}


texts: Drupal.org API for fetching a specific user’s all contributions

texts: I’m looking for an API from drupal.org which will give a JSON of the contributions(credit, commit) for a specific username. I got this https://www.drupal.org/api-d7/user.json?name=[username] but this doesn't have the contributions listed here.


texts: How to get all group content from group?

texts:
I am using OG, Flag and Rules module. I would like to do like this.

When a user click Flag links in Group (name is follow_group) then all group content of that group will be flagged as following.

For now, i'm stuck at getting all group content of specific group. Is there a way to get group content of current group?


texts: Site Architecture and content management

texts:
The problem (more my lack of knowledge) is finding a way to display the content I have in an easy to manage/update manner. The site is comprised of mostly pages of links (they currently pull from a database onto pages in a very simple java setup with template files) and I would like to transfer those to drupal and use content types and possibly views (open to any suggestion) to display the links.

The main and secondary links are to be displayed in the main navigation - secondary links in a drop down - with both the main links and secondary links having pages. click on a main link and it will display all of the secondary links. On the secondary link pages are links categorized under it, so it is basically a three tier navigation.

Because the links are used both in the navigation and page content it would be amazing if someone could enlighten me on a way to enter these in Drupal once rather than multiple places to accomplish my goal and keep the content neat on the backend.


texts: Difference between hide() and ['#access'] = FALSE

texts:
I want to remove the delete button from a standard edit form in certain cases and I'm looking for the right way to do that.

So far I found that hide() marks an element as already rendered so it basically tricks the rendering process.

['#access'] = FALSE does something similar I guess, but still a little different.

In both cases, nothing is rendered concerning the delete button, but does either of them prevent the delete code from being executed on submit (e.g. if a user was manipulating the POST request)?

Or would I need a form_validate() method for that anyway?


texts: Alter the "My Account" link in installation profile

texts:
Well i've tried the following code to insert an attribute to the user-account link on installation profile.It works for all other menu items (Home[]), except the user-account link, probably due to the reason it is rebuilt again.

<?php
   $path = 'user';
   // Check for user (My account) menu item.
   $existing_item = db_select('menu_links')
    ->fields('menu_links')
    ->condition('link_path', $path)
    //->condition('module', 'system')
    ->execute()->fetchAssoc();

  $item = array(
   'mlid' => $existing['mlid'],
   'link_path' => $existing['link_path'],
   'link_title' => $existing['link_title'],
 //'menu_name' => $existing['menu_name'],
   'router_path' => $existing['router_path'],
 //'module' => $existing['module'],
 //'plid' => $existing['plid'],
   'options' => array(
    'attributes' => array(
    'target' => '_blank',
    ),
   ),
 );
 // $item['options'] = serialize($item['options']);
 // $item = _menu_link_build($item);

 // $link['options'] = serialize($link['options']);
 if (menu_link_save($item, $existing) == $existing['mlid']) {

   drupal_set_message(t('User menu target attribute updated'));
 }

The above code :

selects form the database the {menu_links} record for 'user' menu item.
Alter the options in the $item['options'] array
Performs menu_link_save() on the existing item since we have given an existing $mlid

Well, i've tried menu_cache_clear, rebuilds, straight altering the database values.. everything! but the "My account" link is rebuilded after my profile installation routines, even though is the last one.

How this will work?
How can i achieve this kind of alteration in installation profile?

In general, is it possible to override module-defined menu items options/properties in profile, or hook_menu() will run always after my code and revoke all my changes?


texts: Menu items disable and weight resets on save

texts:
Under Admin => Structures => Menus (select any menu item), I am able to create menus with no problem. However if I click save two things happen, 1. any drag/drop positioning I do is not saved and 2. all the menu items get disabled.

In order to keep them enabled I can edit each individual menu item and check the "enabled" box and manually edit the weight in that area and it works. Otherwise it doesn't work.

Also when ever I clear the drupal cache the "show as expanded" ends up disabling and all my drop down menus disappear.

I stepped through drupal and confirmed those fields are passing blank on save. I'm at a loss what to do and not sure how to fix this.

Update: Just to update I discovered one of the issues is my 1st level menu item "Products" was generated from a view. I then manually created drop down items in the menus area and placed them underneath the "Products" link. When ever I would clear the cache the menu would no longer show as expanded and all weights reset to 0 so my menu orders would tank.

Still trying to figure out why the enable/disable check boxes and weights are getting reset on save.

Final Update:
O.k. I've traced it down to the fact that my server is ignoring the those specific form fields. For example the "enable/disable" check box form name was:
name="links[menu_plugin_id:menu_link_content:2e7779b8-6668-4b9f-8a04-049cca46c13b][enabled]

My server would simply ignore this form field name and not pass it to the global _POST variable. I changed the form name too:
name="links[menu_plugin_id:menu_link_content:1][enabled]

and it worked. I thought maybe it was mod_security so I turned that off but had no effect. At this point I'm not sure what it is in my server settings
 CENTOS 7.2 x86_64 standard that's causing these fields to be ignored. I'm not entirely sure what to do right now to work this out.

Hopefully somebody will come across this post someday and it will be of help.


texts:
I'm trying to show user posts in their profile with views 3 by following this post  http://drupal.org/node/228959#comment-4591334

after i add the following code to the contextual filter

if (arg(0) == 'user' && is_numeric(arg(1))) {
  return array(arg(1));
}

and it works, but also giving this error

Notice: Array to string conversion in views_handler_argument_numeric->title()
(line 77 of /test_drupal/sites/all/modules/views/handlers/views_handler_argument_numeric.inc).

Warning: html_entity_decode() expects parameter 1 to be string,
array given in decode_entities() (line 429 of test_drupal/includes/unicode.inc).


texts: User's homepage depending on their organic group

texts:
Is there a way to set the homepage of a user depending on their organic group. So when a user clicks the site logo, they will be redirected to something like /test-page/%group. When I created a panel page it specified that I could not use % which would have been perfect.

I am using Drupal 7.


texts: How to add new form field dynamically on selected change using ajax

texts:
I'm trying to make dynamic form in my module:
I have one field of type select containing some options, and when selecting one option a new field should be added dynamically to the form which in turn will contain another list of options.
here what I try to do but nothing seems to work correctly

public function buildForm(array $form, FormStateInterface $form_state) {
    $this->controller = new Place_AdsController();
    $terms = $this->controller->content();

    $form['#attached']['library'][] = 'Place_Ads/general';
    $form['level1'] = array(
        '#type' => 'select',
        '#description' => 'Please select level one term',
        '#options' => $terms,
        '#attributes' => array(
            'class' => array(
                'mycategory'
            ),
        ),
        '#ajax' => array(
            // Function to call when event on form element triggered.
            'callback' => 'Drupal\Place_Ads\Form\Place_AdsForm::level1SelectedCallback',
            // Effect when replacing content. Options: 'none' (default), 'slide', 'fade'.
            'effect' => 'fade',
            // Javascript event to trigger Ajax. Currently for: 'onchange'.
            'event' => 'change',
            'progress' => array(
                // Graphic shown to indicate ajax. Options: 'throbber' (default), 'bar'.
                'type' => 'throbber',
                // Message to show along progress graphic. Default: 'Please wait...'.
                'message' => NULL,
            ),
        ),
    );
    return $form;
}
public function level1SelectedCallback(array &$form, FormStateInterface $form_state) {
    // Instantiate an AjaxResponse Object to return.
    $ajax_response = new AjaxResponse();
    if ($form_state->getValue('level1') != false) {
        $form['level2'] = array(
            '#type' => 'select',
            '#description' => 'Please select level two term',
            //'#options' => $terms,
            '#attributes' => array(
                'class' => array(
                    'mycategory'
                ),
            ),
        );
        $form_state->setRebuild(TRUE);
    }

    return $ajax_response;
}


texts:
i have a content-type "participants" with a field "number".

i want to calculate the total of all the values that are inserted in all the "participants"-node.

ie:

Node 1 -> 200 participants
Node 2 -> 3 participants
Node 3 -> 15 participants

Total: 218

Only the result should be visible

I was thinking to do it with views, but i'm not succeeding.

Any suggestions?


texts: Is it possible to alter the cacheability of a specific entity either programatically or via configuration

texts:
I am writing a custom breadcrumb builder and discovered that the breakpoint I had set in it was not firing due to cache of the breadcrumb entity. When I inspect it after creation, I can see that it is created as permanently cacheable. Ideally, I'd be able to set something in the services.yml file to tell it to ignore that specific entity. Alternatively, if there were a setter that paralleled the getMaxCacheAge() method, that would work.

As it is, it seems like my only good option here to globally switch to the null cache provider.

FWIW, here's my current little snippet of test code:

  public function build(RouteMatchInterface $route_match) {
    $breadcrumb = new \Drupal\Core\Breadcrumb\Breadcrumb();
    $breadcrumb->addLink(Link::createFromRoute($this->t('TESTING'), '<front>'));
    return $breadcrumb;
  }


texts: Integration of two sites (one is Drupal-based, the other isn't)

texts:
I'm trying to integrate two sites (one is Drupal-based, and the other isn't), and I need single sign-on. How can I realize it?

I have sites on different domains.


texts: Fresh drupal install shows drupal core warning

texts:
I recently installed drupal using git clone option and updated it using composer but I am getting this error I can't fix.

Is there any way to fix this issue? clicking on available updates won't fix the issue. Also, the error related with "LIMITED DATE RANGE" seems mistaken, because I have php7 installed on a 64bit system


texts: How to assign uid in "users" table with imported users?

texts:
I am using Drupal 7.

I am using the Migrate module to migrate a list of users from an external user database table into the Drupal "users" table. The problem is that the Drupal "users" table has a numerical "uid" field, which does not exist in my external database users table.

Could someone please tell me of a way to assign a unique uid to the users table everytime I map a row using Migrate?

For example, right now I have, in the "users" database:

0
1 root ...
//external users start here
2 user1 ...
3 user2 ...
4 user3 ...

Essentially I have would like to start at 2 and continue for each user I migrate over to the "users" table.

More specifically, how I would modify/add a line to the following so that the code can auto generate unique ID's starting from 2? Would the following code be a viable option? If so, where would be the appropriate place to update $counter?

$counter = 2;
$this->addFieldMapping('uid', '$counter');

Thanks.

EDIT:

If I were to use the following SQL statement to do the user migration, would it be a good idea? If it is also a viable option, how might be able to create unique "uid" for insertion into the "users" table?

INSERT INTO users (uid, name, mail,pass,...) SELECT uid, oldusername, email, md5(clear_password),... FROM old_users_table;

Thanks.


texts:
I have a content type PLACE with simple text and image fields. Now I need to add a field to this content type where the user needs to select something for each  month (he can select good OR bad or leave it blank ('nothing') for each month):

Jan: good[ ] OR bad[ ] OR ['nothing']

Feb: good[ ] OR bad[ ] OR ['nothing']]

Mar: good[ ] OR bad[ ] OR ['nothing']

..

..

Dec: good[ ] OR bad[ ] OR ['nothing']

How can I exactly achieve this in a field or maybe with a term reference field (taxonomy)? I know that I could create separate fields for each month, but I think that's a 'bad' way.

Thanks!


texts: Create an Exposed Filter for Integer Values Using Drop Downs

texts:
I'm creating a real estate search, and I'm wondering how I might be able to use the Views module to find properties based on their rent per month using a "Min" and "Max" drop downs as opposed to just using text fields.

Essentially, I would like a filter to appear as "Min" drop down box with arbitrary numbers ($100, $200, $300......$10000) and a "Max" drop down with the same values.

Is this possible with any current modules? If not, is it possible through hook_form_alter()? If so, can someone point me in the direction of how to get acquainted with working with forms in greater detail?


texts: How to Configure both operators(AND,OR) for solr search in drupal 7

texts:
I am using solr search on my site but i need to know how we can use both operators at the same time that is if its not an AND search it should redirect for OR search.
Is there any module for this or views.

Here is my use case:

I have already configured my site on AND search. When there is no search results, that is if user is searching for the phrase "Admin guide" and this phrase is not available, then the search should redirect for OR search and it should count page as match wherever it finds admin or guide word.


texts: How do I retrieve media from a reference field?

texts:
Inside a node type, I have a reference field to target a media.
With a db select, I need to load all related medias of the nodes.
For this I use this code:

$database = \Drupal::database();
$result = $database->select('media_field_data', 'm')
->fields('m', ['mid'])
->condition('m.bundle', 'gallery')
->leftjoin('node__field_related_gallery', 'n', 'media_field_data.mid = node__field_related_gallery.field_related_gallery_target_id')
->leftjoin('field_related_gallery_media_field_data', 'd', 'node__field_related_gallery.entity_id = field_related_gallery_media_field_data.nid')
->range(0, 5)
->execute()
->fetchAllKeyed(0, 0);
dpm($result);

But with this code I get an error and don't get the related mids. If I remove the line with the leftjoin I get the mids.

How can I proceed to verify if a media is related to a node and get only the media with a related node?

With views I can get easily the results with this query:

SELECT media_field_data.mid AS mid,
field_related_gallery_media_field_data.nid AS
field_related_gallery_media_field_data_nid
FROM
{media_field_data} media_field_data
LEFT JOIN {node__field_related_gallery} node__field_related_gallery ON
 media_field_data.mid =
 node__field_related_gallery.field_related_gallery_target_id AND
 node__field_related_gallery.deleted = '0'
 LEFT JOIN {node_field_data} field_related_gallery_media_field_data ON
 node__field_related_gallery.entity_id =
 field_related_gallery_media_field_data.nid
 WHERE (media_field_data.status = '1') AND (media_field_data.bundle IN
 ('gallery')) AND (field_related_gallery_media_field_data.nid IS NOT NULL)
 LIMIT 26 OFFSET 0

Thanks.


texts: How to add a view mode caching dependency in my custom block?

texts: I have a block which renders fields of a node. The output of each field is controlled in the view mode settings of the node entity. Now, how can I add caching which is depended on the view mode settings?


texts: How to insert a new column into mysql field data table?

texts: How would I insert a new column into mysql field data table? For example, if I have a field (myfield) with the mysql table field_data_field_myfield having the following columns'entity_type', 'entity_id', 'revision_id', 'bundle', 'delta', 'language', 'myfield_value' and 'myfield_format'...how could I add the column mynewcolumn as type varchar?


texts: Placing Content Outside of Region Container

texts:
My custom bootstrap sub-theme has a main content region which is the place that all the main content is to go within a .container class.

The code for that section is as follows:

    {# Main #}
    {% block main %}

            {% if page.sidebar %}
              {% block sidebar %}

                  {{ page.sidebar }}

              {% endblock %}
            {% endif %}

            {%
              set content_classes = [
                page.sidebar ? 'col-sm-9',
                page.sidebar is empty ? 'col-sm-12'
              ]
            %}

              {% if page.announce %}
                {% block announce %}

{{ page.announce }}

                {% endblock %}
              {% endif %}

              {% block content %}

                {{ page.content }}
              {% endblock %}

    {% endblock %}

Now I want to create a couple view blocks on my homepage within this main content region but I'd like the backgrounds and content to extend outside the main container and be 100% of the screen width.

Is there a way for me to do this with my current code or is there another way to go about this?


texts: Add another set of field collection to the $form in mymodule_form_alter

texts:
I am working on custom quiz module, where we have Multiple choice questions. We have created separate field collections for Question and it's options. Author can add unlimited number of question and it's answers.

While creating a new multiple choice quiz, Drupal renders a question with one option, but by default we want to render 2 options for one question. How should I add one set of field collection to another filed collection in form alter or is there any field collection configuration?

My scenario:

Question (textarea)

Option (textarea)

We want it to be:

Question (textarea)

Option (textarea)
Option (textarea)


texts: How to install a module which includes a different version of Symfony?

texts:
I am a developer and maintainer for the CiviCRM project. We've been trying to make a Drupal 8 version CiviCRM, and have a come a long way. We're beating our heads against our collective keyboards trying to figure a major blocker for the project.

CiviCRM has used Symfony for a while, and the version that is included is different than what ships with Drupal.

We can get CiviCRM installed with Drupal 8, but after you install it, we cannot install any other Drupal module.

I believe it boils down to a situation where somehow the CiviCRM version of Symfony loads before the Drupal version, and this causes problems.

Does anyone know of a Drupal 8 module that includes a different version of Symfony than the one that ships with Drupal?

Recently I ran across the Ludwig project. This module allows the registering of namespaces in a class that extends ServiceProviderBase.

Would it be possible for the Drupal 8 version of the CiviCRM module to include a CivicrmServiceProvider.php file, which defines a CivicrmServiceProvider class,  and a register() method that adds a container namespace to allow this to work?

Many CiviCRM files have use statements like Drupal starting with Symfony, like here.

We actually put CiviCRM Core into Drupal doc_root/libraries folder, and use the libraries module.

This is the repo for the CiviCRM Drupal module 8.x version, if somebody wants to look at what we got so far. If somebody has the magic elixir for this, I can tell you there would be many happy folks in our community. So if you know how to help us, please do.

CiviCRM does install, and the CiviCRM pages do work. What doesn't work is that after CiviCRM is installed, we can't install other modules via the admin/modules page. As far as I know that's the only thing that is broken. Also installing modules with Drush, after installing CiviCRM, does work.

Trying to install another module after CiviCRM is installed causes the following error:

  PHP Fatal error: Call to undefined method Symfony\Component\DependencyInjection\Definition::setFactory() in /var/www/html/civi-for-d8/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php on line 206

That's in Drupal 8.3.5. Trying to install CiviCRM for Drupal 8 into a clean Drupal 8.4-dev instance causes the following error:

  Drupal\Component\Serialization\Exception\InvalidDataTypeException: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 8 (near "arguments: [@string_translation, @civicrm.page_state]"). in Drupal\Component\Serialization\YamlSymfony::decode() (line 40 of /var/www/html/drupal84/core/lib/Drupal/Component/Serialization/YamlSymfony.php).


texts:
I have the following code in the footer to a view:

<script src="https://mysite/sites/all/libraries/js/listnav/jquery-tablenav.js"></script>
<script type = "text/javascript">
(function ($) {
    $("document").ready(function() {
   $("table").attr("id","myTable");
   $('#myTable').tablenav();
    });
})(jQuery);
</script>

tablenav(), incidentally, is a simple rewrite of esteinborn's excellent listnav.  This works just fine.  Below is an image of part of the Views Preview, and in the Preview the navigation tool works just fine.

The problem is that the navigation tool does not show up in the view itself.  Inspection of the HTML shows that this is not just a case of visibility: the content that is available in Views Preview is simply not in the View itself. Stats:

Drupal: 7.64
Views: 7.x-3.21
jQuery 1.10.2


texts: Combining 2 Queries to pull titles of 2 related content types from the node table

texts:
Time to put our database hats on! We have a complex database call that responds to an AJAX request. We've omitted most of the code to just include the portion that is giving us trouble. We are working in Drupal 7.

  $products = "field_data_field_product_ref"; // table that contains the info about the product
  $productref = "field_product_ref_target_id"; //

  // The following query prints the Title of our Object and the ID of the product it references

  $query = db_query ("Select n.nid AS nid, n.title AS title, p.$productref AS productid
  FROM {node} n
  INNER JOIN {$products} p ON p.entity_id = n.nid");

foreach ($query as $row) {
  print 'Swatch Title: '.$row->title.'
';
  print 'Product ID: '.$row->productid.'

';

}

This outputs:
Swatch Title: Saddle Brown
Product ID: 19
Swatch Title: Sandalwood
Product ID: 20
Swatch Title: Saratoga
Product ID: 22

However, we want to also return the actual title of the product being referenced not its Product ID. A separate query can do this:

    $query = db_query ("Select n.nid AS pnid, n.title AS ptitle, p.entity_id AS productentityid
      FROM {node} n
      INNER JOIN {$products} p ON p.$productref = n.nid");

    foreach ($query as $row) {
      print 'Product Title: '.$row->ptitle.'
';
      print 'Swatch ID: '.$row->productentityid.'

';

    }

Our second query's output:
Product Title: Slab
Swatch ID: 265
Product Title: Stone
Swatch ID: 184
Product Title: Brick
Swatch ID: 185

We would like the results to be:

Swatch Title: Saddle Brown
Product Title: Slab
Swatch Title: Sandalwood
Product Title: Stone
Swatch Title: Saratoga
Product Title: Brick

Can anyone clear up how to combine the 2 queries to get the intended output?


texts: Are blocks still cached when "Cache block" setting disabled but "Cache pages for anonymous users" is enabled?

texts:
I have a site which contains a custom block.  The custom block contains a menu based on a sub-set of the site's main menu.  The problem is that main menu is very large (~1300 items), so generating this particular menu in the block, is quite costly. According to hook_block_info() the block is configured to use DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_ROLE caching methods.

If I go to the site's performance configuration page I notice that the "Cache block" option is disabled; However, the "Cache pages for anonymous users" option is enabled.

In such a situation would the block be cached or not? If it is cached, then would that only be for anonymous users?


texts: How to set Ajax callback from jquery on node edit form?

texts:
I must to create a dependent Fields with three fields in my content type. This fields are select list, but the options for each Field will be prepopulate from a sql query on external DB.

So, this is my form.js file:

 (function ($, Drupal) {
  'use strict';

  Drupal.behaviors.customTest = {
    attach: function (context, settings) {
      getTypes();

      function getTypes() {
        $('#edit-field-test1 option').not(':first').remove();
        alert("test")
        var request = $.ajax({
          url: "../../modules/custom/my_module/script/ajax.php",
          method: "POST",
          data: 'field_test1 =1',
          dataType: "json"
        });

        request.done(function(data){
          var opt = '';

          for(var i = 0, max = data.length; i < max; i++){
            opt += '<option value="'+data[i].id+'">'+data[i].name+'</option>';
          }

          $('#edit-field-test1').append(opt);
        });

        request.fail(function(jqXHR, textStatus){
          alert('Request failed: '+textStatus);
        });
      }
    }
  };
}(jQuery, Drupal));

And this is my ajax.php file:

    <?php
include '../db/bd.php'; <!--This file With host, user, password external DB-->

if(\Drupal::request()->request->get('field_test1')){
    $out = array();
    $sql = "SELECT * FROM `car_type`";
    $res = $db->query($sql) or die(mysqli_error($db));
    while($row = mysqli_fetch_object($res)){
        $out[] = array(
            'id' => $row->id_car_type,
            'name' => $row->name
        );
    }
    echo json_encode($out);
}

So, form.js file is declarated in my_module.libraries.yml, but ajax.php? where should i declare it? how do i use it?


texts: Passing a default value to a custom form element

texts:
I have created a custom element through a module. This custom element is a drop down  element which reads the  values from an array saved in the variable table, which in turn is controlled by a configuration menu (also part of the new module). This all works fine as a stand alone element and would work fine on a new single page form, however the forms I need to implement this element on are multi page forms with an existing hard coded drop down which I am replacing with my new drop down.

The main issue that I am experiencing is that the '#default_value' that is set in the code that creates the form, is not being applied to the new element, I have tried setting this in the form creation script and as a 'hook_form_alter' function, but both of these methods seem to be run before the new element is created. The reason for needing a default value is because the form is a multipage form, which users will be able to click back to previous pages on and edit their previously entered inputs, so when a user clicks back to a previous page, they should be presented with their previously selected title on the drop down field.

Is anyone able to offer me any advice as to how I can set these default values.

The element is called as part of the form creation code using the array entry below:

$form['title'] = array(
  '#title' => t('Title'),
  '#description' => t('Select the delegate\'s title from the drop-down list.'),
  '#type' => 'title_select',
  '#required' => TRUE,
  '#default_value' => !empty($form_state['values']['title']['titledropdown']) ? $form_state['values']['title']['titledropdown'] : NULL,
  '#input' => TRUE,
);

The code to create the custom element which is output is within a custom module:

function person_title_titledropdown_process($element, &$form_state, $complete_form) {

  $title_var_array = variable_get('form_person_title', array());
  $title_array = array();
  foreach($title_var_array AS $k_title => $v_title){
    $title_array[t($v_title['name'])] = t($v_title['name']);
  }

  $element['#tree'] = TRUE;
  $element['titledropdown'] = array(
    '#type' => 'select',
    '#options' => $title_array,
    '#required' => $element['#required'],
  );
  if (isset($element['#attributes'])) {
    $element['titledropdown']['#attributes'] = $element['#attributes'];
  }
  return $element;
}

The relevant portion of the content of the $form_state['values'] array is shown below:

Array (
  [title] => Array (
    [titledropdown] => Lord
  )
  [firstname] => Test
  [surname] => User
  [email] => test@example.com
  [telephone_number] => 01234 567890
  [mobile_number] =>
  [event_code] =>
  [campaign_code] =>
  [terms] => 1
  [delegate_list] => 0
  [del_first] => 0
  [next] => Next
  [form_build_id] => form-Gsxu27DA8V1v2hz9_q9TBxiKsUwFEzUiXjqy_QTEZa8
  [form_token] => OYFyuoo8yToYkHZTzh76-rN2EZLaAukwpV2SxZFjV1w
  [form_id] => events_registration_form
)

The html for the drop down field is output as:

<select class="form-select required" name="title[titledropdown]" id="edit-title-titledropdown" original-title="">
  <option value="">- Select -</option>
  <option value="Mr">Mr</option>
  <option value="Mrs">Mrs</option>
  <option value="Miss">Miss</option>
  <option value="Dr">Dr</option>
  <option value="Prof">Prof</option>
  <option value="Lord">Lord</option>
  <option value="Sir">Sir</option>
</select>


texts: How do I connect vocabularies and filter them to be depend on each others?

texts:
The vocabularies I use are:

TV Channels
TV Shows

The "TV Channels" vocabulary includes 6 terms, where each term represents a TV Channels (e.g. channel<1>, channel<2>, channel<6>).

The TV Shows vocabulary includes 30 terms, where each term represents a TV Show, but not all of them belong to a one TV Channel, but some of them belongs to channel<1>, and others for channel<2>.

I've already created a content type, and added various fields for these vocabularies using term references.

How do I make a filter? When I choose the TV channel from the filed, and then move to the next filed for the TV Show I should only find the ones belonging to this TV channel, and not the whole TV shows from all the channels.

This is a very clever idea, but will it allow me to list all TV Show episodes when I click on any given TV Show link?

Also about the main presenter, how can I add it to the content type the same way?

My point is to find a way to list contents in the website as a whole by:

TV channel
TV show
Main presenter and guest
Topic
Date of broadcasting

So I've created various taxonomies like the following:

I created a vocabulary for each one of the above first four items.
I added terms for each one of them:

TV Channel vocabulary
TV Show vocabulary
Main Presenter & Guest
Topic

I have installed these modules:

Chaos Tool Suite
Form Elements - Hierarchical Select
Panels
Taxonomy Menu
Views

I added a content type with these fields:

TV Channel
TV Show
Main Presenter
Guest
Topic
Broadcasting Date: This one I need to make it in a pop up calender way so if I click on any given date to list all episodes for various TV Shows from any given TV Channel.

The first five fields are term reference fields.


texts: Can Display Suite render content without my theme around it?

texts:
I'm just getting familiar with Display Suite and I want to know if I can use it to display only the content - not my header/footer/etc from my theme.

My goal is to display this content in a modal popup so I don't want anything around it.


texts: 7 - Add classes to individual fields of paragraph bundle

texts:
Hi in paragraphs module for drupal 7, how can we assign classes/html tags to individual field items of paragraph bundle?

There is Classy Paragraph module that lets us to add classes to the paragraph wrapper/section. How to achieve the same for individual fields of paragraphs?


texts: How to open all external links in a new tab

texts:
I want to create a small module to open all external links in the menu in a new tab, how can I do that?

I think I should use hook_link_alter to do it, but i don't know how to do it so i can select all the external links only?


texts: How to show report output below a submitted form?

texts:
I'm creating a form with a submit button. Below the submit button after the user submits some input data, I want to display the results of a report that I create by querying the database using the input variables that the user input on the form.

I can get the submitted form variables to appear by going to nameofmodule_form_submit() and typing $form_state['rebuild'] = TRUE;, but how do I add to the HTML of the page?
If I can't add to the same page (below the Submit button), how do I add it to the next page? And in which function should I do my db_select processing?


texts: Adding a table with items and prices to a drupal site

texts:
I am not sure how to ask this question, but I hope I will be making myself clear.

We are building a CMS-like site for the most part, but the customer also wants the capability of adding a prices table for goods that can be consumed by a user on a daily basis.

So far, there is a custom content type 'user daily report' whose purpose is to store info of the likes of:

user1 - 2015/05/01 - 1 breakfast - 1 lunch - 3 drinks

At the end of the month, I have to be able to provide a report which summarizes how much the user has to be charged for his/her accumulated consumption.

I'm not sure how to exactly phrase my question here, since I'm fairly new to Drupal. Therefor I'll try to describe my requirement / question using some language I'm more familiar with:

Have Drupal create a products table, a prices table (foreign key-ed to the products table), and add a couple fields to the daily report content type (product_id, amount).
In order to create the monthly report, I think I would just use a grouping SQL query (with group by and sum).

The above is not very 'drupalish'. But at the same time, I fail to see how the products and prices tables could be implemented using content types.

To make the question more precise, it is actually a 2 parts question, being:

1) I am not sure that putting the products and prices info inside of Drupal is best achieved by using custom content types. What is the best way to go for you people when faced to this type of functionality?

2) What is the best way of extracting/summarizing the info at the end of the month? I have struggled my way using the views module, but being myself much of an 'old school programmer' I am not necessarily confident that all I need can be achieved by using 'views'.

With all that in mind, my question is: what's the best approach to achieve this goal in a way that integrates well with 'the Drupal way'?

Any hint on the topic is most welcome!

Thanks In Advance!

PS. I've tried the entity-references + views_calc way with a wee prototype.
In general, I feel satisfied with the tests I've carried out.

What we need to be able to implement is several tables of products/prices available to different sets of users. All of it based on organic groups (we are using an openatrium distribution).

Using an entity-reference as a field in the users content type, and then adding the necessary relationship when using the views module, I can get what I need. Plus with the Views Calc module I get the summarized stuff.

I still have to try it all in our fully fledged openatrium dev install and see what happens when associating products/prices to groups. But so far, seems promising.

I've learned that my original version of the question didn't fit the questions policy because it was too loose and prone to answers based in personal opinion vs facts (and sorry about that). Maybe the edited version will prevent it from getting closed?

I'll choose Pierre's answer as right, as it has certainly been helpful.


texts:
I have content-A (Events) and Content-B (registration to the Events) which has node-ref field referencing content-B to content-A.
Content-A has selection field-A and Content-B has some other fields witch I need to show or hide on form load (when adding or editing content-B) depending on content-A field-A selection.
If i try to use rules event: 'Content-B node form is being built' - I cannot use Conditions to search for Content-A fields value. I tried other events like before content is being saved but then I can't change fields conditions.

Can anyone tell me what is best solution to achieve this task?
thanks for any help ..


texts:
I have a variable that holds a serialized string that I want to convert back into a PHP Array.

$str = 'a:1:{i:0;a:3:{s:2:"id";s:24:"xxxxxxxxxxxxxxxxxxxxxxxx";s:11:"description";s:3:"Two";s:9:"users-idt";s:36:"x6543rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrd";}}';
$arr = unserialize($str) // returns an empty;

But when I take the same string an run unserialize() on it outside Drupal, it works perfectly. Could this be a drupal issue?,

Using Drupal 7


texts: What will happen at worst if I change the "Number of values" of CCK field

texts:
I have a CCK text field and set "Number of values" to a certain number.
Now I want to change it to "Unlimited".

It says

Warning! Changing this setting after data has been created could result in the loss of data!

What will happen at worst if I change this?
The values of already existing nodes might be really gone as it says?
If yes, there is no way to change this to "Unlimited" if I already have some existing nodes?


texts:
Is it possible to rewrite parts of taxonomy terms URL custom aliases before output, for example with something similar to the the following code?

  function replace_term_url ($term_alias) {
    // Url alias "article/first"
    $term_alias = str_replace("article", "article-sub", $term_alias);
  }