texts: Extract field from content type in View and have it appear as a block next to appropriate node

texts: I need to pull a field from a content type and have it appear as a view in the sidebar next to the node it belongs to. I can't figure out what parameter to use in Views to indicate that my view block should appear by the node it was extracted from. Maybe something to do with relationships?


texts:
I'm storing the session details from Drupal to share with another system, so users don't have to log in twice for each system.

It appears that my hook_user_login is being called twice.  Right now I'm just calling:

mymodule_user_login(&$edit, $account) {
  debug(session_id());
}

to see if the session I'm storing is the same as the session being used.

I'm getting the debug statement twice, with two different session_id values.
Am I missing something here?


texts: Commerce Feeds Node Parser Problem: product SKU "missing" from mappings causing empty product displays

texts:
I'm rebuilding a commerce site and I'm trying to use Commerce Feeds to bulk import my products. The issue that I'm having is that the node parser isn't mapping to the product SKU which is creating incomplete product displays. The title is imported, but most of the product display is empty until you manually set the SKU to the correct product. Doing this manually defeats the purpose of bulk importing them in the first place.

I even tried to import the working importer from my other site, but there the SKU mapping is labeled "Missing."

So, 1) what can I do that I don't have to manually set the SKU's for my products?

2) why is the product sku missing from the mapping options?


texts: How do I sort a view based on when a specific field was last updated?

texts: I have a field(field_video) for Embedded Videos. I have a view that shows a list of all Videos and I want to be able to sort that view by when the video was last accessed(Recently Viewed), when the video was added(New Videos), and total number of views(Popular). Is it possible to sort a view based on attributes of the field? I have a quicktab that would then show a block of each view by each specific sort criteria.


texts: How can I create a link from an organic groups content node back up to the parent OG?

texts: I have used Organic Groups 7.x-2.7 to create groups and can create content which is allocated only to that group. When I am viewing a group content node how do I create a link back up to the parent group? Ideally I'd like to be able to create a views block with this link in it.


texts:
I'm trying to write a simple JQuery function in order to animate my mobile navigation. However, I'm not sure how to format the .js file. I've looked up some examples online, but I couldn't get my function to work, when I tried to use the example templates. Here's what I'm currently using, which works in Chrome, but FireFox logs an error, which I'll also post below:

My code:

(function ($, Drupal) {
      $(function(){
        $( '#mobile-menu-toggle-button' ).click(function(){
          $( '.mobile-menu-toggle' ).toggleClass( "open" );
        });
        $( '.overlay' ).click(function(e){
          if(e.target != this) return;
          $( '.mobile-menu-toggle' ).toggleClass( "open" );
        });
      });
})(jQuery, Drupal);

FireFox errors:

ReferenceError: Drupal is not defined

I'm thinking my formatting is off. Any help would be greatly appreciated.


texts: Drupal Dashboard - Set Permission to role for each widget?

texts: I am using Drupal 6 Dashboard version 6.x-2.0. Is there any way to set the permission of each created widget?


texts:
I have a Views of users (friends of the current user) and I have added a VBO field to it. The objective is that when an event is created by the current user, their friends receive an email about it.

I created a Rule, and using VBO (release 7.x-3.3), I try to send an email to people. Right now, the loop is not picking up any data, even if the View is working properly. Am I missing something?

PS: The rule first shows a message to confirm that it has been triggered, and I am testing the loop with a status message.

{ "rules_test_loop_triggeredvbo" : {
"LABEL" : "test_loop_triggeredVBO",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "views_bulk_operations" ],
"ON" : { "node_insert--event" : { "bundle" : "event" } },
"DO" : [
  { "drupal_message" : { "message" : "Rule when event is created is TRIGGERED" } },
  { "views_bulk_operations_action_load_list" : {
      "USING" : {
        "view" : "clone_of_profile_friends|page",
        "args" : "[site:current-user]"
      },
      "PROVIDE" : { "entity_list" : { "entity_list" : "A list of entities" } }
    }
  },
  { "LOOP" : {
      "USING" : { "list" : [ "entity-list" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "drupal_message" : { "message" : "User has friend:  [list-item:name]" } }
      ]
    }
  }
]
  }
}


texts:
Once you go to create a new issue in drupal.org you can see a message that says:

  Learn how to report an issue. Use the issue summary template to
  summarize the issue in the Description field below. Others can also
  change the summary. Editing the summary does not subscribe you to the
  issue or notify subscribers, so add a comment describing your changes
  after any significant edit.

But there are some closed issues like Incorrect call to urldecode() in the www.drupal.org site that don't follow the template format.

Should I edit a closed issue with the issue summary template?


texts:
Recently all users (except UID 1) lost the ability to add content.

When going to node/add we get the message "no content types created yet"

When going to node/add/page we get "Access Denied, you are not authorized to access this page"

There are people having similar issues like here - https://www.drupal.org/node/1073994

I have already checked the navigation menu to see if that was the issue, since it seems to be a known bug, but this was not the case. All the permissions are set correctly in the permissions UI and database too.

I am not sure if this is relevant, but the site was migrated from 6 to 7

Any insights would be appreciated!


texts: How to use JQM theme and jQueryMobile plugin with Drupal?

texts:
I'm developing a mobile web site with Drupal 7 and i want to use jQuery mobile. I've found many plugins, but just one available with drupal 7 (jQuery Mobile module). I have also a jQuery mobile theme (jQM Theme). My problem is that doesn't work (there is just html, no css and jquery mobile displayed).
Is there someone who used this plugin and theme ? Or could you give me an efficient way to create a mobile web site with Drupal 7 ?

Thanks,
Gen


texts: Unset (remove) a field (views_conditional will not work)

texts:
I have a view that produces a table.
In addition to the fields defined in the source nodes, I've added a link to "edit the node" via the Views admin UI.

Obviously, this link should not be visible, or better yet, not rendered at all unless the user has privilege. So - based on some business logic, I want to suppress  the "Edit the Node" link at runtime depending on (in this case) whether the user has edit privileges.

A similar question here was answered with a recommendation to use https://www.drupal.org/project/views_conditional

This will is not a very viable alternative because:
1) It generally (exclusively?) relies on conditional based on other fields (handy, but not applicable)
2) I don't want complicated logic hiding in a View.

I have tried to get hook_views_pre_render() to work - but no success.
Again, if this was a "normal" field pulled into the view->result object, things would be easy.
The field name is 'edit_node'. But I'm stumped on how to remove it.
I have tried:

$view->field['edit_node']->options['exclude'] = TRUE;

No success


texts: Colorbox plugin installed but status report is not recognizing it

texts:
I have installed the Colorbox plugin version 5.1.14 in /sites/all/libraries/colorbox but on the status report page I get the following:

  You need to download the Colorbox plugin and extract the entire contents of the archive into the sites/all/libraries/colorbox folder of your server.


texts: Show full list of nodes that reference the node being shown

texts:
I have a content type (let's call it course) and a content type named edition (if we have a course named "English 101", we can have "English 101 - June", "English 101 - July" and so on.) For this, I used Entity Reference.

If I see the node "English 101-June", I can see the "parent" node being rendered (I chose that on Manage Display". What I want now, is when I see the "parent" node "English 101" the full list of referenced nodes to be rendered. How can I do this?


texts: I need to add nodes in grid style i.e inline adding of the nodes should be done there only. i.e use can add any number of nodes at a time.


texts: Display block if content type has entity reference (tags) that contains specific term

texts:
I want to display a block when a node contains a entity reference field when specific term is present.

I have tried numerous modules that did not work for me or perhaps I did not set them up right, term_condition token_conditions entity_field_condition (using the appropriate patch)

EDIT: it seems the term_condition works on a clean install after applying some pending patches on the issue queue.  So this probably is a problem with my installation.


texts: Commerce Price Table: What would cause sporadic zeroing of prices when adding to cart?

texts:
I'm having an issue where the prices in the price tables are sometimes being applied when adding items to the cart, and later, other items are set to zero when added to the cart. First off, I must mention that I am working with products that have 3 price tables, and each price table has 4 price breaks. I wasn't exactly clear on if/why support for multiple tables was or wasn't possible, but I am worried that this might be the culprit. If it's not safe to have multiple price tables for a product, please let me know right away!

Other details: Each of the 3 price tables for a product is for a different user role. I use field permissions on a multipage view to make this possible. What may make it complicated is that not every product has a price for each role. That is to say, not all products are available to all roles. To combat this, I added a filter to only show items where the price is not $0.

I'm very deeply entrenched in this module, as I have several commerce feeds going and thus have spent many hours formatting the incoming data in the CSV files, so Commerce Pricelist would not be a good alternative.


texts: How to Display "Tabbed" content from Views in Panel / Pane in Node Template

texts:
I would like to add a pane with tabbed content to a specific content type/Product display.

Using the guidance provided on drupal.org/node/2209747, I built a series of tabbed content in Views, using "Menu Tab" and creating new pages. (No problem, but not where I want to display the views.)

My goal is to embed this tabbed content into a pane (in Panels Node Template). However, when I select the view, I am required to specify either "Master", "Page 1", "Topic A", or "Topic B".

These options remove the tabs and either show all content (Master/Page 1) or filter content (Topic A or Topic B).

Is there a way to embed the tabbed view using only the Views module?
Should I create a Content Pane, instead of a page?
Can I avoid using an additional module like Quicktabs?

I assume that I am running into trouble because the tabbed view depends on the url path differentiation and cannot work when dropped into a pane. (At least with my current approach.)

Any help is appreciated!
keb


texts:
I'm not talking about updates within your site, I'm talking about waking up in the morning, checking your email and seeing an email sent to you from Drupal.org that new core version is out.

7.58 critical update just came out and I found out about it from a buddy.

I clicked follow at https://www.drupal.org/project/drupal but I get no email notification about any core versions coming out. I get only notifications for module issues that I'm subscribed to, I expected the same when clicking Follow in the modules page.


texts: How to create a select list that contains url links

texts:
This is probably a very noob question but here it is none the less. I want to create a select list that contains the names of places around the world. When the user clicks on a name, it uses a hidden url to go to that place. So what the user sees is a normal select list of place names (not links), when they select an item then they are taken to that page.

On the manage field tab of the node that this is implemented on, I tried creating a select element with the following options:

 http://www.australia.com|Australia
 http://www.germany.com|Germany

But this doesn't work. What do I need to do to accomplish what I want?


texts: How do I create custom regions in a theme?

texts: I want to add a new area which will be site wide. Describe the process of getting this new region into my theme, if possible generalize it for adding any new, custom region.


texts: trigger a form submission button using custom cron

texts:
It's possible to create a cron that trigger the submission of a form ?
To be clearer, when my drupal cron is executed, this form will be submitted automaticlly ?
EDIT :
This is an explantion for what reson is the cron :
Im using apachesolr for indexing articles in my website,
some times it happen that some editors in the site delete articles, but the problem, these articles still exist in apachesolr... and when solr try to index again, the hole website crashes !!
so that's why I need to find out these deleted articles and delete them from solr indexing also...
this module do exactly what I need : apachesolr_integrity
this module add a new submission button in apachesolr configuration page : /admin/config/search/apachesolr to Delete orphaned nodes..
But I don't need every time the site crashes, I click on this form button, maybe the site administrator is not available that time, and the site still breaking :(
I thought about cron to do this this, and also if it can be made with rules, it will be a better solution because with rules I will tell system to directly delete Orphaned nodes when a content has been deleted, and with a cron, the site can still crashed until the next cron execution..
Anyway, the question is how can I add the code made by this module in either a cron or a rule.
Thanks in advance


texts: How to display contact form module in a block using drupal 7

texts:
Possible Duplicate:
  Put Site-Wide Contact Form in a Block

I want to display the contact form in a sidebar of the website. Is it possible? Please help me.


texts:
Hi there i hope you can help. Drupal info below.

Core module :   6.22
Installed modules: CCK, Views, Image, SEO.

I have a custom field called field_type which i need to group by.

After searching in vain on the internet for a long time I'm unable to find an answer that works.

Could anyone give me step by step instructions how to create a view like the sketch below.
Basically each item has a type assigned to it, and i need to group the results of the view by type. Preferably with a title above the group to say which type it is.

Type 1 -

Item 1, Item 2, Item 3, Item 4

Type 2 -

Item 5, Item 6, Item 7, Item 8

Type 3 -

Item 9, Item 10, Item 11, Item 12

Thanks!


texts:
I'm trying to use the Match redirect module and follow the basic description I've tried the following:

/my-path-1/my-path-2/*

to

/my-path-2/*

OR

/ma-path-2/

And it doesn't work. I do have pages like:

www.example.com/ma-path-2/page-title

that works fine as expected, but when I visit

www.example.com/my-path-1/my-path-2/page-title

I was expecting to be redirected to:

www.example.com/my-path-2/page-title

Which did not happen. Why? What am I missing here?

Thanks in advance


texts: How do we know the required parameters of hook's callback method?

texts:
I am working on creating a filter module starting with the hook_filter_info file. This hook requires a callback method via a 'process callback' filter setting.

Now the problem is: how do I know what parameters that this callback method requires? I have taken a look at filter.api.php and see this:

function hook_filter_FILTER_process($text, $filter, $format, $langcode, $cache, $cache_id)      {
$text = preg_replace('|\[codefilter_code\](.+?)\[/codefilter_code\]|se', "<pre>$1</pre>", $text);
return $text;
}

but I have seen this callback filter called like this :

mymodule_process($text, $filter, $format);

mymodule_process($text, $filter, $format, $language);

mymodule_process($text, $filter, $format, $language, $cache);

...

Now how do I know the amount of arguments that this method requires? Or does it require any argument at all?


texts: Rules- How can I make a variable/token with the site URL minus the language path?

texts:
I have created a rule set to handle login redirects for users on my site.  If a user logs in from a page that is set to a different language from that user's language (example: English user logs in on a Japanese page), the user will be redirected to a page with the same language as the page upon which they logged in (in the example, a Japanese page).

To fix this, I want to force my redirects to be the appropriate language path based on the user language.

However, the [site:url] replacement pattern which is provided by Rules includes the language path (because it is the front page).

My front page is https://mysite.com/en.

I want to create a new variable which is the URL of my site minus the language path:
https://mysite.com/

I tried creating a variable of type text with a value of

<?php substr("[site:url]", 0, -2); ?>

but for some reason this just gives me the value of [site:url]; it appears that the substr() function has no effect.  I don't understand PHP very well so I could be missing something obvious-- I just want to remove the last two characters of the [site:url].  How can I do this within Rules?


texts: Manually removing database records of a module

texts:
I inherited a Drupal 7 site that appears to have a history.

I'm receiving the following error when updating modules or clearing the cache:

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'website_staging.search_api_server' doesn't exist: SELECT base.id AS id, base.name AS name, base.machine_name AS machine_name, base.description AS description, base.class AS class, base.options AS options, base.enabled AS enabled, base.status AS status, base.module AS module FROM {search_api_server} base WHERE (base.status IN (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2)) ; Array ( [:db_condition_placeholder_0] => 3 [:db_condition_placeholder_1] => 2 [:db_condition_placeholder_2] => 6 ) in EntityAPIController->query() (line 187 of /home/website/apps/api/docroot/sites/all/modules/entity/includes/entity.controller.inc).

The question is: where in the database do I need to remove any and all traces that point to this table?

Background:

I figured this was just a module that somehow did not install its tables right somehow. Uninstall, reinstall and done, right?

Two problems:

Uninstalling a module also yields this error, and does not work
The Search API module (http://drupal.org/project/search_api) never was installed at all

It appears the previous developers created a custom module, and named it 'search_api'. My guess is that later they went and did a blanket update of the site modules using drush, and starting updating the custom module far enough to install something to the database. Then they realized their mistake, and replaced the custom module in its original location (but did not rename it).

Nowhere in my modules is there a pointer to the search_api_server table, so it must be somewhere in the database.

So my plan as it stands is:

Somehow fix the error
Uninstall the custom search_api module
Rename the custom search_api module and reinstall

And I need some help with step 1


texts: How to get url and description of FileFieldItemList's items in node template

texts:
I have a content type called publication which results the node's twig template: node--publication.html.twig.
This content type contains a multiple file fields where the description is allowed.

I would like to share it with you, because it took a lot of time for me to find out how can I iterate through and render the items of a FileFieldItemList which would be a very easy thing without the drupal theming system.

Some of you might find useful it.


texts:
I've been struggling with trying to create a custom xml REST API in D8 to replace a simple Views RSS feed (that is imported into other D7 sites using a custom Feeds importer) in a D6 site that's being migrated, and after pulling my hair out with the custom REST endpoint, I'm looking at doing what I did in D6, which is to create a Views RSS display. However, the feed requires some customization, so I need to determine how to add custom fields to the RSS feed. For other feeds in D7 sites, I've used the Views RSS module to add fields, but the D8 branch is still apparently not stable, so that does not seem to be an option.

To customize my RSS feed, I need to do two things:

Add custom elements (hook_nodeapi($op = 'rss item') in D6)
Modify the query so only nodes with specified tids in a term reference field based on a views global null param passed in (hook_views_query_alter() in D6)

So it appears that for an RSS Feed display in D8 views, the only fields displayed in the feed are the ones predefined in the row style settings (using Fields as the row type). With the Views RSS module not being available, is there a way with core Views to override the view to add custom fields (such as a class override)? I appears I can still use hook_views_query_alter() to modify my query, but it doesn't do me much good if I can't add fields.

I could probably spend a few hours reading through code, but if anyone has a quick answer as to the best way to add custom elements to a D8 RSS display, or could point me in the right direction, I'd appreciate it.

Thanks.


texts:
Why does the theme layer uses render arrays when all the theming functionalities can be implemented with print statements in templates files?
Is there any analogy that explains the use of render array in the theme layer and how it interacts with the template files?


texts: How can I have multiple content types pick up the same template?

texts:
I want to override the template for 5 content type that they have all the same attributes, but a different name ,so the suggestion  is :

node--contenttype1.html.twig
node--contenttype2.html.twig
node--contenttype3.html.twig
node--contenttype4.html.twig
node--contenttype5.html.twig

how can i implement a same override for all those 5 content type ?


texts: entity eck create new property type or/and behaviour

texts:
I guess everyone here has done what I want multiple times and I am probably just stupid but I can't seem to find it.

So in my drupal 7 installation I want to create an entity with a date property(so all bundles have a date that is set by a user). Perfect scenario is that this date is like the date field with calender to select a date.

I can't find how to do this but that's probably because I have no idea what to look for.

Can someone put me in the right direction for this?

Making it more clear:
I could just add a date field in all bundles but that seems not the best way to me and I would like to learn drupal in it's best practice.

thanks in advance


texts: Remove string from [node:url] and node alias

texts:
Background

We have enabled content translation where we detect based on the content language. This allows us to translate properly as needed, but it has a bad side effect.
It will not only add ?language_content_entity=en to the canonical metatag, but if we have any links that return node URLs, it will also append ?language_content_entity=en. This happens for both logged in and anonymous users.
Under the metatag settings for each content type we are using the [node:url:absolute] token for any path field and that also returns ?language_content_entity=en in the URL.
On the /admin/config/regional/language/detection, under Content Language Detection we have the following Detection Methods enabled in order.

Content Language
Cookies
Selected Language

Question

How can we remove ?language_content_entity=en string from the node's path alias and [node:url:absolute] token?

What we tried:

In order to remove the ?language_content_entity=en from the canonical url, we used the best answer from How to override canonical URL?.
tried using hook_link_alter, but it did not find method to remove string from URL.

Only set methods I can see when I do the following:

function mymodule_link_alter(&$variables) {
  ksm($variables['url']);
}

Example:


texts:
is there a way i can bypass the drupal cache for a specific element on my website?
in my case i've got 3 header graphics which should be displayed at a random order on every page load.


texts: Is there a way to use a file field without having to upload the file when creating the content?

texts: I’m using Commerce File module for creating mp3 products. I’ve been unable to create a bulk feeds importer because of having to upload the files. Is there a way to simply add the file name when creating these products? The files would have already been put on the server.


texts: How to approve comments from a user with previously approved comments

texts:
WordPress has a useful option for comment moderation in its Discussion Settings panel called "Before a comment appears: Comment author must have a previously approved comment".

How can one configure Drupal to approve future comments if a user has a previously approved comment in the site?

This is a follow-up from an unresolved post on Drupal.org: Auto-publish comments after that anonymous user’s previous comments have been approved [X] number of times


texts: Change text field editor in database after upgrade

texts:
When upgrading a website to Drupal 8 from Drupal 6, format filters are disabled and it's necessary to setup new format for text area as :
http://alvinalexander.com/drupal/how-to-upgrade-migrate-drupal-6-8-notes

But where drupal store this setting for custom text field into the database ?
This is important to know to elaborate the SQL query.

Thanks


texts: Limit Webform Submission to one per quarter per user

texts:
I need to limit one webform submission per quarter. For each quarter, the user can only make one submission. I want to use one webform. Here are some examples of the date period and the due date. How can I achieve the desired outcome with Webforms?

Q1 (Oct. 1, 2019 – Dec. 30, 2019): due by Jan. 15, 2020
Q2 (Jan. 1, 2020 – Mar. 30, 2020): due by Apr. 15, 2020
Q3 (Apr. 1, 2020 – Jun. 30, 2020): due by Jul. 15, 2020


texts: Update Webform Submission from subsequent form on confirmation page

texts:
I am trying to update a webform submission from a form on the confirmation page. My callback function is as follows, but it's not updating the submission. What is the correct syntax to accomplish this? I'm getting the webform node and the submission are loaded correctly but the webform_submission_update is not updating the record. What am I doing wrong?

$nid = 3389;
$webform = node_load(3389);
$sid = $form['sid']['#default_value'];
module_load_include('inc', 'webform', 'includes/webform.submissions');
$submission = webform_get_submissions($nid, $sid);
$email = check_plain($form['your-email']['#value']);
$submission->data[14]['value'][0] = $email;
webform_submission_update($webform, $submission);


texts:
I recently tried to move my Drupal site to a new server using this page: Moving Drupal 7 site to a new server.
But now the style doesn't seem be loaded and more importantly I get this error on every page in the site (even on the frontpage):

Warning: file_put_contents(temporary://filef76T9k): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1900 of /Library/Server/Web/Data/Sites/Default/drupal/includes/file.inc).
The file could not be created.

Any ideas what this could be about?


texts:
I've run across a problem where, when open_basedir is enabled in my php.ini, my file uploads don't work in Drupal. The parent directory is included in the open_basedir list, yet uploads still don't work. I've tested this both on my development server (running Windows Server 2008, IIS7 and PHP 5.3.2) and locally on my pc with XAMPP (running Windows 7 Enterprise, Apache 2.2 and PHP 5.3.5). The results are the same: as soon as open_basedir is disabled, file uploads within Drupal work perfectly.

Here's an example of the error I get:

Warning: move_uploaded_file(): open_basedir restriction in effect.
File(public://field/image/example_1.jpg) is not within the allowed path(s):
(K:\content;L:\content;E:\content;E:\Upload_temp) in file_save_upload()
(line 1528 of E:\content\includes\file.inc).
File upload error. Could not move uploaded file.

This is what my File System settings are:

Public file system path - sites/default/files/pictures

Temporary directory - sites/default/files/pictures/tmp

Directory structure goes like this: E:\content\drupal. As evidenced, Drupal is within the bounds of open_basedir. What am I missing here?


texts: JQuery hoverIntent / Drupal contrib hoverIntent module not working

texts:
I'm trying to get the jquery plugin hoverIntent to work on my Drupal 7 installation.
No luck.

1st, I tried the logical approach; simply the following to the theme .info file.
scripts[] = js/jquery.hoverintent.js
Doesn't work, and causes other problems.

Then I tried the contrib hoverIntent module. I can see that the script is loaded on the page, but calling  .hoverIntent from within Drupal results in nothing happening.

$(function() {
  $(".views-field-field-profile-picture").hoverIntent(teamIn);
  $(".team-name-info").mouseleave(teamOut);
});

Anyone with success in getting hoverIntent to work? Why is this so difficult?


texts: Construct POST data and send it to an external page

texts:
Is there any way to construct post data and send it to an external URL, like how a form will send POST data to action URL?

I am aware of drupal_goto() function, but it is not possible to send POST data using it. I am also aware of drupal_http_request(), but I do not want a response from the URL here. I just want to submit data to the URL from my custom module. How can I achieve this? Any help is appreciated.


texts:
Is it possible to display dynamic result based on the URL, with the Views module?

I have a database table with thousand messages, and I would display those containing the words in the URL. For example, with test.com/variableparent/variableschild, it should display the text containing the  variables_child variable.

I tried with the filter, but I have to put a specific word, not a dynamic one.


texts: How do I configure the recurring node checkout payment?

texts:
In the past years, I use commerce node checkout to published a node when the user checkout completed. Now I want to automatically, charge user when their node published expired.

How can I link the node to the recurring product, so the recurring payment happen when the node expire every month?


texts: Custom Options Value of Views Grouped Filter?

texts:
How do I change the select values of a Views groups filter?
By default, they are 1,2,3...
Default

<select>
<option value="all">all</option>
<option value="1">Group A</option>
<option value="2">Group B</option>
</select>

Desired Result

<select>
<option value="all">all</option>
<option value="mycustomname">Group A</option>
<option value="mycustomname2">Group B</option>
</select>


texts: How do I create a block that shows content related through a second level relationship?

texts:
I have three node content types, called 'pathway', 'page' and 'relation'.
The relation nodes I use to connect pages to the pathways.
The relation nodes have reference fields: endpoint A and endpoint B.
I want to create a views block of all relation nodes, which use endpoint A reference (pathway) to referene the same patway as the relation that references the currently viewed node using endpoint B.
The purpose of the block is to show all relations of the pathway on every page that is referenced by one of these relations.


texts: Generate PDF with Print PDF and send in email

texts:
When a user registers he has to select some options that will be defining for the invoice created afterwards.

I have a rule that will be executed when saving a user account. This is what I do:

Rule 1: Create Invoice (invoice = content type) and Save Invoice
Rule 2: Fill in Invoice

The invoice is generated when a user registers an account. When I go to the invoice like this:

http://domain.com/node/147294

I see the Invoice. When I go to http://domain.com/printpdf/147294 I get a pdf with my content in it.

Now I would like to create a pdf and send it in a mail to the user that is registrated (an extra rule). But how can I do this?


texts: Using ajax to filter drupal autocomplete form

texts:
I'm trying to build a custom search form, and I want to limit the scope of the search with a dropdown select menu, ie. choose "jewelry" in the dropdown menu and the autocomplete form will only return matches of that category.

Here's what I have so far:

function mymodule_search_menu() {
$items['mymodule_search-autocomplete-test'] = array(
'title' => 'Test autocomplete',
'page callback' => 'drupal_get_form',
'page arguments' => array('category'),
'access arguments' => array('view published content'),
'type' => MENU_NORMAL_ITEM,
);

$items['mymodule_search-autocomplete-engine'] = array(
 'page callback' => 'mymodule_search_autocomplete',
 'access arguments' => array('view published content'),
 'type' => MENU_CALLBACK,
);
 return $items;
 }

function mymodule_search_form($form, &$form_state) {
$form = array();

$form['category'] = array(
    '#type' => 'select',
    '#title' => 'First Dropdown',
    '#options' => array('All','Product'),
    '#ajax' => array(
    'callback' => 'mymodule_search_ajax_callback',
    'wrapper' => ???,
    'method' => ???,
    ),
);

$form['search_autocomplete'] = array(
'#title' => t('Search'),
'#type' => 'textfield',
'#maxlength' => 60,
'#autocomplete_path' => 'mymodule_search-autocomplete-engine',
'#prefix' => '
',
'#suffix' => '
',
 );

$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Søg alt',
 );

 return $form;
 }

function mymodule_search_autocomplete($text) {
$results = array();
//query products
$query_products = db_select('commerce_product', 'p');
$query_products
->condition('p.title', '%' . db_like($text) . '%', 'LIKE')
->fields('p', array('title'))
->orderBy('title', 'ASC');
$res = $query_products->execute();
while ($res1 = $res->fetchAssoc()) {
  $matches[1][$res1['title']] .= check_plain($res1['title']);
}

array_unshift($matches[1], "PRODUCTS");

//query content
$query_content = db_select('node', 'n');
$query_content
->condition('n.title', '%' . db_like($text) . '%', 'LIKE')
->fields('n', array('title'))
->orderBy('title', 'ASC');
$res = $query_content->execute();
while ($res2 = $res->fetchAssoc()) {
  $matches[2][$res2['title']] = check_plain($res2['title']);
}

array_unshift($matches[2], "CONTENT");

$matches = mymodule_search_flatten($matches);
$newmatches = array();
foreach ($matches as $match){
$newmatches[$match] = $match;
}

drupal_json_output($newmatches);
}

function mymodule_search_ajax_callback($form, $form_state) {
  ???
}

As you might see, I have 2 different querys in my autocomplete function, and (I think) I would like to limit the result to only the selecteded querys with help of an ajax call from the dropdown category.

Oh, and don't mind all the "unshifting" and looping that goes on in the autocomplete function - I have to have category headers in my result, and this was the only way I could think of to do that.

If there's a better way to do this, or if you know how to accomplish this, please let me know.

Thanks!!


texts: How do I pull a value from a Paragraph field and put it in a template?

texts:
I would like to pull a value from a field I have in Paragraphs.

I have a content type called "Landing Pages" (landing_pages)

I have a paragraph type called "Landing Page" (landing_page)

The field in the said paragraph type that I would like to pull is called "Background Color" (field_background_color)

As you can probably guess, I would like the user to be able to set the background color of the individual Paragraph. I have figured out how to get the template to display said inline style, but I am puzzeled on how to get the value in the "style=background-color:" tag.

Any help would be appreciated


texts: Spammers apply for an account, how to disable other users from applying for an account on my website

texts:
I am using drupal 7 and get messages like these several times a day:

Account details for sizemutter at "my Website Name" (pending admin approval)

sizemutter has applied for an account.

I am afraid that I may approve one of these by mistake. Is there a way to make it for them impossible to apply and to stop spamming me?

Thank you!


texts: What is the purpose of Translation field in form display mode?

texts:
When editing the form display mode of a translatable content entity, there is a field called Translation in the UI. I thought this field would manage the weight/visibility of translation meta data fields (like content_translation_uid or content_translation_outdated) in the entity's edit form.

But moving that field around doesn't have any effect, it neither reorders the position, nore does it hide the Translation <details> element when I move it into the disabled section.

So, what is the real purpose of the field Translation in /admin/structure/ENTITY/manage/BUNDLE/form-display ?

(This is a follow-up of my question  Custom content entity: can't hide translation details in edit form)


texts: How to make user profiles of specific role as public in drupal 7?

texts:
I am working on a project and the problem I am facing is,

There are 2 user roles Doctor and Patient.
What I want to accomplish is profile of users with role of "Doctor" is accessible by all including anonymous and profile of users with role "Patient" is accessible by user himself and all the users with role of "Doctor".
Rest no one can access the profile of "Patient" role.

Any help is much appreciated.
Thanks in advance.


texts:
I am building my site using drupal 7 and adaptivetheme.

Before I used superfish module, my main menu was very responsive and works great across all sizes.

Now, I started to use superfish (latest version) for the dropdown in my horizontal main menu, and the menu is not responsive. when I am resizing the window, the right tab of the menu is moving below the menu, instead of the text will get smaller.
but, If I resize just a little more it  looks like the text is getting smaller for less then a seconed, and than all the horizontal menu (6 tabs) become one dropdown with all the tabs inside.
I know that in a very small screen the menu is collapsing to one drop down, but why does it happen in a size of landscape tablet (and even a little bigger)?

How can I make my superfish main menu responsive, and become smaller (like the rest of the site) when the window size is getting smaller?


texts:
I am using Drupal 6 and trying to use db_query to delete rows from a table based on joins in order to untag a certain node of all tags of certain vocabulary.

This http://drupal.org/node/1079620 implies that delete doesn't work when using joins.

So I have a tried all the following forms of $queries:

1) $query = "DELETE a FROM {term_node} a LEFT JOIN {term_data} b ON a.tid = b.tid WHERE a.nid = %d AND b.vid = %d";

2) $query = "DELETE a FROM {term_node} a, {term_data} b WHERE a.tid = b.tid AND a.nid = %d AND b.vid = %d";

3) $query = "DELETE FROM a USING {term_node} AS a, {term_data} AS b WHERE (a.tid = b.tid) AND a.nid = %d AND b.vid = %d";

Before running

$result = db_query($query, $nid, $vid);

None of them deletes the rows from database. I have checked that $nid and $vid get the appropriate values and when I take of the curly brackets and run the query in phpMyAdmin it works like a charm.

I tried to perform simple query where there are no needs from joins. It didn't work either. But once again it works perfectly if I run the query in phpMyAdmin.

I started thinking could it be somehow related to the Drupal batch processing. The delete query not working gets executed when feeds module is performing a batch process (importing nodes to Drupal). So does Drupal during batch process somehow restrict access to tables or something? I didn't find anything in the mysql logs.


texts: Imce file browser not showing select button

texts:
The IMCE file browser seems to be missing it's select button. On this File field, I'd like content creators to choose an image that is already located on the server (not uploading a new image).

What setting might I have missed?

The field on this content type is configured as follows:

The profile is configured as followed:

File Permissions
The /tmp folder is owned by the apache user and is chmod'ed to 2775. The /sites/default/files/images folder is owned by apache and chmod'ed to 755.


texts: Create a view on a entity using criteria on another entity

texts:
I'm trying to this done :

I have two entities

1) Listing Details
2) Listing Premium Settings. This entity references the first Listing Details entity.

In the second Entity I have referenced entity 1 Listing Details, added with fields for a StartDate and a EndDate.

I would like a view on Entity 1 where I will use the StartDatet and EndDate of Entity 2 as a filter.

I have tried contextual, I have tried Relationships, but I guess I do not graps the essences of both ... :-(

Anyone who can help me get this done ?

I use Drupal 8.7.
I am a newbie.

Alex


texts: How to generate 'tag' field in form config module?

texts:
I'm need to create a tag field (the field that you see in this stackexchange.com website for tagging)

I'm wondering is there any api for this or this has to be created from scratch?

If this has to be created from scratch, how to make a 'custom' field in drupal - a very simple sample will be much appreciated.


texts: Organic Groups Views contextual filter is not working

texts:
I am trying to make a view in which I have to show images from an image-field of an organic group content type. I have tried for many hours but I am unable to make it work. I am trying to explain the scenario:

I have a venue (organic group) content type. For each venue there is an image field which can hold multiple images. I want to show a list of images that belong to a specific venue. For that I have to make a view so that I can show a list of images belonging to that specific venue. I have used the following path string:

/group/%/images

Now what I want is that for example, I want to visit a "pizza-house" venue, then the path string of the view will be:

/group/pizza-house/images

Now on this page I only want to show images from multiple image-field that only belong to "pizza-house" venue (Venue content type contains that field).  For achieving this, I have tried the following contextual filter and relationships as in shown the pictures but of no use :/

Please help me figure out what I am doing wrong? I am new to contextual filters and  organic groups.
Thanks in advance.


texts: How to bulk delete selected content/nodes?

texts:
I want to bulk delete data and along with it I need check-box where I should able to "select all" data to delete. I tried the Delete all module, which is helpful to delete all the content, but it's all or nothing.

Sometimes I may not want to delete all the content/nodes. Therefore, I would also like to be able to select which specific content/nodes gets deleted only.

Can anyone help me on this?


texts: How to place content/user field value inside of a rules action?

texts:
I'm trying to grab the contents of a field in my node of custom Content Type 'Messages'. The field is called 'targetuser'. I successfully grab the content of this field, and place it inside a field on my User profile called 'last_user_messaged' with the rule 'set a data value'. Hooray...

I then fetch the entity type User (see second action), and the field/property last_user_messaged (site:current-user:field-last-user-messaged), which in theory, should now return the data I'd set there with my first action.

That said, when I try and set my third action 'Send a push notification to a user account' with the data selector [last-messaged:1], upon execution, my logs tell me that it's empty. Technically, shouldn't last-messaged:0  return the first value inside field last_user_messaged? And last-messaged:1 return the second value? Or am I reading this wrong?

In short: I want my push notification to send to the integer (a uid) that is placed in last_user_messaged field.

I hope this makes sense.


texts: How to get grid items to align center in Bootstrap views?

texts:
I'm using Bootstrap views Drupal 7.

Live site is over here to have a look at the code:

http://xuzo.com/testing/

When a 3 column grid gets minimized, the 3 items stack 2 on top and 1 on the bottom.

But the bottom one is left aligned.

How can I have them align in the center so I get a nice triangle?

This looks easy with css, but I can't get it to work, tried:

 margin: 0 auto;

And others but can't get it working for some reason...


texts: How can you let an editor edit the text in a block, but not make other configuration changes, as moving the block from one region to another?


texts: Composer issue after I deleted the vendor directory

texts:
We have Drupal 8.8.5 running on CentOS Linux 7 with PHP 7.1.33.

Was trying to update modules using composer. Composer said they were updated, but when I went into program, they weren't. In troubleshooting, I deleted the "vendor" directory. Now, I get this error:

  [root@ip-172-31-13-94 master]# composer update --with-dependencies
  Loading composer repositories with package information
  Updating dependencies (including require-dev)
  Your requirements could not be resolved to an installable set of packages.

  Problem 1
  - drupal/core-recommended 8.8.0 requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.8.0-beta1 requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.8.0-rc1 requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.8.1 requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.8.2 requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.8.3 requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.8.4 requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.8.5 requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.8.x-dev requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.9.0-beta1 requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.9.0-beta2 requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - drupal/core-recommended 8.9.x-dev requires composer/installers v1.7.0 -> satisfiable by composer/installers[v1.7.0].
  - Conclusion: don't install composer/installers v1.7.0
  - Installation request for drupal/core-recommended ^8.8 -> satisfiable by drupal/core-recommended[8.8.0, 8.8.0-beta1, 8.8.0-rc1, 8.8.1, 8.8.2, 8.8.3, 8.8.4, 8.8.5, 8.8.x-dev, 8.9.0-beta1, 8.9.0-beta2, 8.9.x-dev].

Can someone tell us how to resolve this? Thanks!


texts: Dynamically change Commerce Customer profile type on checkout

texts:
I need the following in Drupal Commerce:

On checkout, two radios should be presented (e.g. Email & Postal)
Upon selection of one of these, a different customer profile type should be attached to the order
Only fields related to the selected profile type should dynamically show up.

I'm perfectly able to accomplish this through FormAPI, but that wouldn't be tied to the Commerce system unfortunately.

Someone knows how the right way?

Thanks


texts:
I need to show my website with a "theme" when in header's requests is present a particular key/value.

In Drupal 7 I do this via themekey, but this module does not exist in Drupal 8.

Are there alternatives, or other ways to do this?


texts: Getting the node link in views-view-fields.html.twig

texts:
I've created a block display view to list recent posts on a page. Which variable can I use inside the views-view-fields.html.twig template file in order to retrieve the link to the post?

        {{ fields.field_image.content }}

    read more +

{{ fields.title.content }}

    {{ fields.body.content }}


texts: Content subscriptions/notifications from multiple terms?

texts:
I have a clothing site where multiple taxonomy vocabularies are used for content. For example, there are "Boys" and "Girls" terms, and clothing size terms such as "2" "4" "6" etc., as well as "Seasons" and "Sport" vocabularies.

A user only wants to be alerted when "Boys" "4" "Basketball" new content is posted.

I am aware that modules such as Notifications, Subscriptions, Simplenews, etc. exist -- but these only allow for new content notifications based on a single taxonomy term.

Could this be done with Rules (e.g. content type that contains each users' subscribed terms)? Or some other way, perhaps using Flag?


texts: Get list of taxonomy terms for current node through Views

texts:
I've been trying this for awhile, and I keep finding answers that are close - but not quite.

If there is a node with taxonomy terms attached to it, I want to create a block in Views that I can place in the sidebar that will load the terms that are attached to THAT node.

I want to do it through Views so I can rewrite the URL with a custom query using the term IDs.

I'm open to other suggestions as well! I've also tried Display Suite, but I didn't want to go too far down that path just yet. The attached image is ideal, where the category taxonomy terms are being loaded based on terms that are attached to the node.

Ideal Wireframe Example


texts: How to properly set up a filtered Gmap view

texts: I have Gmap set up, and the maps are showing correctly on the individual nodes. The "Node Locations" link in the sidebar is also showing them correctly. However, I want to filter this view, and can't quite figure out the correct way to set this up. The closest I've gotten so far has all the pushpins in the upper left corner, rather than distributed across the map. Pointers would be most welcome. Thank you!


texts: Selecting the number of Records from Textbox

texts: I am trying to built a text box where I can type in the number of records that I want to select. So if I type in "100" the first 100 records should be selected and then will assign it to user. How do I make built this text box where it would select first 100 nodes and then perform the action of assigning it to user.


texts: Multiple node references using url-widget

texts:
I am trying to set up a structure of three content types where two references to one or more parents.

The main content type is assignment
The second is assignment_image that references the assignment content-type, this I have solved using the node references url widget.
The third is assignment_vote. This content-type needs to reference both the assignment and the assignment_image.

I can't figure out how to use the node reference url widget to reference two values. I don't want the user to be able to change these values so the autocomplete/selectboxes are not viable options.

I have thought about doing this using hidden-fields and jQuery but I really would like to be able to use existing modules/code.

Does anyone have any ideas?


texts:
I have never had the need to do this before today, but it doesn't seem like you can make OR queries with EntityFieldQuery, since db_or is used for select queries.

An example would get to all entities that has a date field where the value is null or after today.

Am I missing something or some trick or is this simply not supported?


texts:
Description of entity type properties in code is very poor and I cannot find alternative resources. Could anyone explain those properties?

For example: "data_table" is described as:

  The name of the entity type's data table.

But it doesn't explain anything.

I created a custom entity based on "examples" module, added "data_table", "revision_table", "revision_data_table", added revision entity key, but after drush updatedb --entity-updates only myentity_revision table was added, and I still cannot see myentity_data_table, and other tables that "node" entity is using for example. Why is that?

Could someone explain those properties, what they are precisely for, and as a bonus - how they relates to "setRevisionable/setTranslatable" methods that we can invoke when creating field definition?


texts:
I need to add product via services, but I have strange issue with a price field.

The case is that all fields saved correctly except price field amount and it returns:

  The requested URL returned error: 500 Internal Server Error : An error occurred (0): Unable to get the data property amount as the parent data structure is not set.

The url which is used: endpoint/product.

Here is the code:

fields `$node_data = array(
  'sku' => 'sku1',
  'title' => 'product title',
  'type' => 'product',
//  'commerce_price_amount' => array('amount' => 122.000, 'currency_code' => 'KWD'),
  'commerce_price_amount' => 12.000,
  'commerce_price_currency_code' => 'KWD'
); 12.000,
  'commerce_price_currency_code' => 'KWD'`

which successfully added all fields except price.

I think it relate to price field format.


texts: How can I access the variable from other .tpl.php file?

texts:
I am working on Advanced forum. And for my need I am editing advanced-forum.naked.post.tpl.php and I want to add the author name at one place. But this template do not have author name, but it has entire author pane printed. Now the variable for the author name is in advanced-forum.naked.author-pane.tpl.php. And it has a author-name code

<?php /* Account name */ ?>
      <div class="author-pane-line author-name">
        <?php print $account_name; ?>
   </div>

now if I am direct pasting this code to advanced-forum.naked.post.tpl.php, it shows error, that variable is not defined.
Moreover, both this tpl files are in the advanced forum module/style file. So, how can I access that variable in that .tpl.php file? Very Thanks.


texts:
I have this output from my twig template dump:

/var/www/html/vendor/twig/twig/lib/Twig/Extension/Debug.php:56:
array (size=7)
  'id' => string 'views_block:about-block_1' (length=25)
  'label' => string '' (length=0)
  'provider' => string 'views' (length=5)
  'label_display' => string '0' (length=1)
  'views_label' => string '' (length=0)
  'items_per_page' => string '3' (length=1)
  'background' =>
    array (size=1)
      0 => string '136' (length=3)

So my file id (fid) is 136. I'd like to know a way to get this file's url without having to use a preprocess function.

Can this be done? Would I have to do a custom twig function to achieve this? If so where would I add the code to extend twig?

ex:

$twig = new Twig_Environment($loader);
$function = new Twig_SimpleFunction('function_name', function () {
    // ...
});
$twig->addFunction($function);


texts: Can I set a CSS-class on the node in a view list based on a text field of the node?

texts:
As I understand, I need a module like this: https://www.drupal.org/project/field_formatter_css_class but for Drupal 8

For example, I want to highlight one node in the views using CSS-class, how to do this?

PS

Finally I got necessary result:

/**
 * Preprocess function for views-view-grid.tpl.php.
 */
function themename_theme_preprocess_views_view_grid(&$vars) {
   foreach ($vars['items'] as $row) {
        foreach ($row['content'] as $item) {
             $subclass=$item['content']['#row']->_entity->field_fieldname;
             if(!empty($subclass[0])){
                $item['attributes']['class'][] = 'col-'. $subclass[0]->value;
             }
        }
   }
}


texts: Restrict Location per Domain in OpenLayers

texts:
I have Domain Access and Open Layers running on a site. Think of it as a map-based Craigslist. Each city has it's own subdomain, offering location-based content.

Users create content with a location on each subdomain, and I need to make sure that content's location is inside a radius (say, within 50 miles of a centerpoint) for that subdomain.

How can I do this?


texts: Batch API passing data to finished function

texts:
I am creating a batch import and I would like to pass two different counts to my finished function. For example in my 'operations' function I check for an NID if it exists update the node if it doesn't then create it.

In my 'finished' function I want to do something like:

 batch_import_finished($success, $results, $operations) {
   if ($success) {
     $message ='Nodes created: '.$nodesCreated. '<br />';
     $message .='Nodes updated: '.$nodesUpdated;
   }
   else {
     $message = 'some errors';
   }

  drupal_set_message($message);
}

Hope this makes sense.


texts: Problems translating strings for my module

texts:
As far I as know, the t() function is supposed to collect the strings and allow for their translation at admin/config/regional/translate/translate. This is not happening though for my module's string. Despite disabling the module + flushing the cache + enabling back, the string does not show up there.

I'm aware of the filters and case-sensitivity of the search field.

Any ideas as per what is going wrong?


texts: Very simple but working drush extension?

texts:
I want to implement my own Drush command, and struggle because while the "Make me a sandwich" example is very good, it's also quite complex, and for someone that has never made such an extension it's easy to loose track of what is mandatory, and what is optional.

I would like to see a basic Drush extension implementation.


texts: What is the hook to alter workflow access permissions?

texts: In the Workflow module, How can I programmatically change permissions? In addition to roles I want to check against a proflie value to allow or not allow users see or edit a node in a specific workflow state.


texts: How to show the node delete tab and put a view in it?

texts: I would like to show a 'Delete' tab near the 'View' and 'Edit' tabs in the node page and insert a custom warning message and a view in it. If I create a view tab page with path /node/%/delete it works fine, but the submit button is missing and I can't figure out how to add it. Any idea?


texts:
I am trying to insert the languageswitcher block and login block into the menu. So basically I am after inserting custom html into menu or change the html of a menu link.

Looks like the best place to do this is hook_preprocess_menu(). A dirty workaround is adding it under a desired menu item by finding that item with a condition check.

But there should be a more "Drupal way" of doing it. In Drupal 7, AFAIR, I could set the whole html of a menu item. But as you can see in the following kint() output, I couldn't find room to do that.

Here is my workaround:

function mytheme_preprocess_menu(&$variables) {
  if (isset($variables['menu_name']) && $variables['menu_name'] == 'main') {
    foreach ($variables['items'] as &$item) {
      $attributes = $item['url']->getOption('attributes');
      if (isset($attributes['class']) && in_array('locale', $attributes['class'])) {
        if ($block = \Drupal\block\Entity\Block::load('languageswitcher')) {
          $copy = $item;
          $item['is_expanded'] = true;
          $copy['locale'] = \Drupal::entityTypeManager()
            ->getViewBuilder('block')
            ->view($block);
          $item['below'][] = $copy;
        }
      }
    }
  }
}

The condition I check here is a class I added with the menu_link_attributes module.

Then I print it in menu--main.html.twig. I am using a Bootsrap submenu and putting here the whole code for reference:

{% import _self as menus %}

{#
  We call a macro which calls itself to render the full tree.
  @see http://twig.sensiolabs.org/doc/tags/macro.html
#}
{{ menus.menu_links(items, attributes, 0) }}

{% macro menu_links(items, attributes, menu_level) %}
  {% import _self as menus %}
  {% if items %}
    {% if menu_level == 0 %}

    {% else %}

    {% endif %}
    {% for item in items %}
      {%
        set item_classes = [
          item.is_expanded? 'expanded',
          item.is_expanded and menu_level == 0 ? 'dropdown',
          item.in_active_trail ? 'active',
        ]
      %}
      {% if menu_level == 0 and item.is_expanded %}

        {{ item.title }}
      {% elseif item.locale %}
        {{ item.locale }}
      {% else %}

        {{ link(item.title, item.url) }}
      {% endif %}
      {% if item.below %}
        {{ menus.menu_links(item.below, attributes.removeClass('nav', 'navbar-nav'), menu_level + 1) }}
      {% endif %}

    {% endfor %}

  {% endif %}
{% endmacro %}

So the actual question is, what is the Drupal way of doing this?


texts: Convert integer retrieved from node field to uid?

texts:
I've created a rule that sends a push notification to a specific user when a certain content type node is published. That said, in order to specify which user receives the notification, the 'Send Push Notification to Specific User' rule requires that I type in an existing uid.

That said, I've pulled an integer from a content type field, and I want to set that integer as the uid to send the notification to (as the user receiving a notification changes often). Naturally, Drupal won't let me do that, even after I convert the retrieved string (numeral, e.g. 7) to an integer.

Is it possible to achieve this? I'm stumped.


texts: Ubercart - Manual Credit Card Processing

texts:
This has ALWAYS been the reason why I haven't used Ubercart...the lack of a module that allows for offline (manual) credit card information.

It has been a few years now since I looked last and I am wondering if this is STILL not an option with Ubercart. I did some searches and it still looks like there is nothing.

Anyone?


texts: How to alter the state of a radio button in an exposed filter to "checked" based on the view URL?

texts:
I have a D7 site where I have several main topics, each containing subtopics.  I've made a views block which is shown on each of the pages of the main topics where you have two filter options:

Filter on main topic
Filter on subtopic

The idea is that when the user enters a URL like www.mysite.com/topics/maintopic, the main topic filter radio button is set automatically to the main topic the user entered and the first sub-topic for that main topic.

So how can I do that?  I tried with a contextual filter, but unless I missed something I don't see an option to preselect a radio button in an exposed filter (nor in fact to filter basing on the last part of a URL, unless it's an argument). I also tried the following code.

function MYMODULE_form_views_exposed_form_alter(&$form, &$form_state) {
  // ...
}

I didn't see any option to alter which radio button is selected.


texts:
Drupal 7 had a neat feature of different bootstrap levels that allowed to write really fast micro services that didn't require to fully bootstrap Drupal.

Drupal bootstrap levels no longer exists in Drupal 8, but what would be the best approach to build some kind of microkernel to handle simple database queries? I'd like to initialize the database and configuration to do some SQL queries and send a JSON response.


texts: What causes my error "Illegal choice in Sorted by element"?

texts:
Drupal 7.50 commons

The following error shows dozens per minute when I run drush ws --tail,  but there are no reports of users encountering errors or features that are non-operational. Does anyone know what could be causing this? Reporting for anonymous user.

error     form  Illegal choice  in Sorted by element.

Below is a screenshot of one of the errors, for detail.

Below is a screenshot of part of the page content that might be generating the problem, from admin/reports/dblog.

The error seems to be affecting more than one group or all of our groups. Here is an example URL from another entry:
http://example.com/groups/oregon?sort_by=&sort_order=DESC&page=0,0,1

Here is the Commons Browsing Widget View Sorting Criteria:


texts: Redirect do not work. Redirects to it's original page

texts:
No matter what, no matter what source to what path. E.g. I have this node/7, so when a link appears somewhere in the website with path to node/7 so when clicked I want this to be redirected lets say to node/3, or frontpage, or external, or anywhere else, doesn't matter, just explain me why does it still open the actual node/7? And no, my frontpage is not set to node/7.

Settings (given urls are just examples):


texts: How do i show/hide page content depending on the users role?

texts:
I am creating a site that has several roles.  When some one who is logged in goes to a certain page I want the page to determine what content needs to be displayed depending on what roll they are.

Example.  If the user is attached to the "teacher" role then they will see "Hello teacher thank you for visiting our site" then it might have two buttons that leads them to certain pages.  If they are attached to the "student" role they will see "Hello student thank you for visiting our site" then the two buttons would be different and lead them some where else.

Is there a module that could help with this?


texts:
I have a sub directory in my files directory which I want to store private images. I display the images with their watermark, via the imagecache modules.

I thought I could make the directory (with the original images) hidden to the public simply by dropping an .htaccess file in the folder, with

deny from all

but the files are still publicly accessible. What am I missing?


texts:
I'm trying to substitute a variable in a db_query but keep on getting this error:

Recoverable fatal error: Argument 2 passed to db_query() must be of the type array, string given

It's a single item string that I'm trying to insert:

$primary_key = db_query("SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE (`TABLE_SCHEMA` = 'mydatabase') AND (`TABLE_NAME` = '%s') AND (`COLUMN_KEY` = 'PRI')",$mytable)->fetchAll(PDO::FETCH_ASSOC);

I've tried wrapping the variable in an array but then I get no results. How do I substitute my variable here?


texts:
Users on my site generally have several roles.  However, every once in awhile I get a spam user, and so I close that account by flagging it with a spam flag, which triggers a rule to block the account.

Since I compile statistics on my site based on the number of users having a given role, I don't want spam users to be included.  How can I automatically remove all roles from spam users?  (I suppose I could add rules components to check for each role and remove it if found, but there has to be a more efficient way...)


texts: Why am I failing to programmatically create a webform in hook_entity_insert?

texts:
I need to create a webform programmatically when a node is created.
I refer and follow https://www.drupal.org/project/webform/issues/3038697
Here are the steps to reproduce:

Create new module via console, and install module.

In module.module add:
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Serialization\Yaml;
use Drupal\webform\Entity\Webform;

Add hook with webform create function:
function module_entity_insert(EntityInterface $entity){
  // Build a render array of elements.
  $elements = [
    'name' => [
      '#type' => 'textfield',
      '#title' => t('Name'),
    ],
  ];

  $settings = [
    // Define settings.
  ];

  // Append default settings.
  $settings += Webform::getDefaultSettings();

  // Create a webform.
  $webform = Webform::create([
    'id' => 'custom_id',
    'title' => 'Title',
    'elements' => Yaml::encode($elements),
    'settings' => $settings,
  ]);

  $webform->save();
}

Now, after save and cache clear, go to add new content (any type will do).
Suppose I have new sample webform created along the new node creation, but here is the error message:

The website encountered an unexpected error. Please try again later.Drupal\Core\Entity\EntityStorageException: Object support when dumping a YAML file has been disabled. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 847 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Drupal version is latest, fresh install. What am I doing wrong? Or what's missing?


texts: How much RAM does a basic installation need?

texts: I am looking to downgrade from a dedicated to a VPS server (several, to spread it out) and was wondering if 512MB will do? I have Boost with all core caching enabled, and mostly anonymous traffic.


texts: Drush Segmentation fault when upgrading from Drupal 6 to Drupal 7

texts:
I am running drush -vd updb --yes || exit 1 to upgrade D6 to D7 then I got this error several times atleast.

Bootstrap to phase 0. [0.01 sec, 4.79 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 5.08 MB] [bootstrap]
Cache HIT cid: 5.0-commandfiles-0-eae08ebb5299072299ae95f485024c57 [0.02 sec, 5.09 MB]                                                                                [debug]
Bootstrap to phase 0. [0.06 sec, 11.02 MB]                                                                                [bootstrap]
Bootstrap to phase 2. [0.08 sec, 11.03 MB]                                                                                [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.09 sec, 11.03 MB]                                                                                [bootstrap]
Initialized Drupal 7.14 root directory at /var/www/vhosts/git/html [0.12 sec, 15.06 MB]                                                                                [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.12 sec, 15.07 MB]                                                                                [bootstrap]
Initialized Drupal site default at sites/default [0.12 sec, 15.07 MB]                                                                                [notice]
Cache MISS cid: 5.0-commandfiles-2-d0694fde84f442a7d33c2119cff575f2 [0.13 sec, 15.07 MB]                                                                                [debug]
Cache SET cid: 5.0-commandfiles-2-d0694fde84f442a7d33c2119cff575f2 [0.27 sec, 15.09 MB]                                                                                [debug]
Found command: updatedb (commandfile=core) [0.28 sec, 16.05 MB]                                                                                [bootstrap]
Segmentation fault

Any idea what is segmentation fault is?


texts: Give non-administrator users acces to node-class

texts: I have installed "node-class" on my drupal webiste. As an administrator, i can assign a class now to a node, but other verified users can't...?


texts:
I create a module and I create a template for that .

I use this code in mymodule.module :

function mymodule_theme($existing, $type, $theme, $path) {
  return [
    'moduletheme' => [
      'render element' => 'form',
      'variables' => array('test_var' => NULL),
    ],
  ];
}

And I use this code in mymodule/src/Form/MymoduleForm.php :

public function buildForm(array $form, FormStateInterface $form_state) {
    $forms['#theme'] = [
        '#theme' => 'moduletheme',
        '#test_var' => $this->t('Test Value'),
    ];
    return $forms;
}

And I use this code in mymodule/templates/moduletheme.html.twig :

Test twig template!

test_var: {{ test_var }}

But when I clear cache and refresh my module page , I just see :

Test twig template!
test_var:

How can I fix this problem in drupal 8 ?


texts:
I have a view that show content of a specific content type, based on some exposed filters.

Each node is "owned" by a user, and i want to provide statistics for how many times their node have been shown in a view (not hov many times the node have been viewed fully).

Then i want to provide the owner of the node with statistics like:

Views today, X
Views last 7 days, X.
Views last 30 days, X.

Any smart ideas?


texts: What would be the best to retrieve all fields (or field instances) those utilizing filter formats?

texts: I want to get all fields that utilize input formats. What would be the good way to achieve it?


texts: How do I update jQuery to the latest version I can download?

texts: I'm using Drupal 7, which uses jQuery 1.4 as default? How can I update it to the latest version (currently 1.7)?


texts: Inserting space/gap between two main menu links

texts:
In my main menu, I have the following links: Home, About Us, Blog, Log In and Sign Up.
I want the Log In and Sign Up links to float to the right such that there will be space/gap between the 'Blog' and 'Log In' links.

Please how can I achieve this?


texts:
Im using Drupal 7, and I am trying to make a slide show with a numbered pager like the one shown in this page. I added PHP code in Views, thinking I could simple put PHP code, but the problem is that it is not producing the expected result.

I used this code, which is supposed to print "1 2 3 4", and that instead prints "1 1 1 1."

$i = 0;
$i++;
echo $i;

In this code I tried using one of the variables, and I think I am on the right track with this one, but it prints "10 9 8 7," while I want it prints "1 2 3 4."

$i = 0;
$i = $row->field_image;
echo $i;

I know that this is probably something simple, but I can't figure out how to save my life; any help is greatly appreciated.


texts:
I want to add an additional field on each orders, and that field can be edited. I've installed the Field Collections module. I've added a field in the order settings using the Field Collection field type. Inside that field, I've created a textarea, created by and edited by field. I've used entity reference in created by and edited by to check which user created the field and who edited the field.

How can I set a default value (created by and edited by) when the order has been edited/newly added using rules? or if not possible to do this in rules, is it possible to achieve this in hook_form_alter?


texts: How to add custom class on the menu block using twig?

texts:
I'm new in Drupal 8 and i'm trying to display my primary menu block using twig as below

 {% if page.primary_menu %}
   {{ page.primary_menu }}
 {% endif %}

which gives me like this

      <a href="/drupal8/" data-drupal-link-system-path="<front>" class="is-active">About

      <a href="/drupal8/" data-drupal-link-system-path="<front>" class="is-active">Home

I want to add my custom class attributes on ul  and a elements to get the menu like this

      <a href="#about" data-drupal-link-system-path="<front>" class="page-scroll">About

      <a href="#home" data-drupal-link-system-path="<front>" class="page-scroll">Home

How can i add my custom class on the menu? If you have any idea about this problem then please help me. Thank you.


texts: How can I create template for login and register page separately?

texts: In drupal 8 how can I create template for login and register sections separately ?


texts: Perform action once a form has been validated

texts:
On Drupal 7, I would like to execute some code once a form has been validated.

I have seen many usage of hook_form_FORM_ID_alter : implementing this hook and adding a custom callback to $form['#validate'] I could perform action on validation.

But I need to be absolutely sure the form has been validated to perform my actions.

Is there some other hook to do so ? Or something I could do in hook_form_alter to ensure that ?


texts: Sort related nodes in block views based on a score calculated with common vocabulary

texts:
Is it possible in drupal8 with Views to show related nodes in a block based on a score calculated with common vocabulary (each common tag adds some  affinity points depending on vocabulary type).

The sorting in views is ordered by:
1- Editor manual selection.
2- Best related nodes ordered by max affinity with the current node
3- Nodes sorted by date

Regards,
Thanks for your help


texts:
I have alredy created profile2 type with machine name "user" and now i would to overide template, can someone explain me how i have to name my new tpl? i ve copied existing, and tried some rename variants, but i didnt find solution.

In google i didnt find solution too.

Here is link for module https://drupal.org/project/profile2


texts: How to use ajax_command_invoke() with an argument that's a JavaScript object?

texts:
I'd like to use ajax_command_invoke() to enable jQuery UI Droppable when returning from an AJAX request.

If I run the following command from the JavaScript console, jQuery UI Droppable is properly enabled:

jQuery('.elements-to-make-droppable').droppable({
  drop: function( event, ui ) {
    jQuery( this )
      .addClass( "ui-state-highlight" )
  }
});

However, when I try to return this command from my AJAX callback:

$commands = array();
$commands[] = ajax_command_invoke('.elements-to-make-droppable', 'droppable', array('{
  drop: function( event, ui ) {
    jQuery( this )
      .addClass( "ui-state-highlight" )
  }
}'));
return array('#type' => 'ajax', '#commands' => $commands);

...it doesn't work.

How should I be doing this?


texts:
I need to make the deployment easy between my staging and production servers.

How can I do this? I need to deploy all the changes, so if I pull from Github and run the script, the changes are applied!

Has anyone written any script or module for this?

I am using Drupal 7.


texts:
I'm struggling to find a working method for populating the key & value pairs of a select field (created with forms api) with data from a view.

e.g.. I have a view of 'location' content types.

In the form I've created I need a drop down showing all these location names and a reference from their content type as the key.

Can anyone suggest the easiest method?


texts: How to remove panel-separator CSS in mini-panels?

texts:
I have an issue with a mini-panel which prevents me from aligning social buttons:

I tried to set:

.panel-separator { height: 0px; width: 0px; }

in my CSS, but the Google +1 button is still under the ShareThis buttons, rather than next to it. The only difference is that FireBug displays the div line as shaded. There is enough space on the right of the ShareThis buttons for the Google +1 button.

How can I solve this? Thanks. If it matters, I am using Panels Everywhere with the Versatile theme.

UPDATE

I tried .panel-separator { display: none; }. It improved the situation, but did not solve it:

I am including more requested information:

UPDATE II

I asked another question and the issue is now solved.


texts:
By default search results show title, snippet, author details, date and content type in the listing so the next logical step would be what tags / categories... However I have been totally unable to find any details on the subject.

In search-result.tpl.php I would like to list each nodes taxonomy terms, how is this possible?

Not really worried about the output of the terms but would just like the terms available as a array within the template.


texts: Can FileTransfer be used to target remote FTP servers?

texts:
I need to send files to a remote server within an ajax callback.
Snooping around Drupal's includes, I came across the FileTransfer class, but I haven't fully understood the concept of its access limit to $jail (defaults to Drupal's root).
Is it possible to use this class to access remote FTP directories as well?
If so, how?


texts: How to import nodes with custom fields using Feeds module and Feeds JSONPath Parser

texts:
I've got a content type called 2Wd-Tractor with this structure :

Model (node title)
Engine
Transmission
Operational
Hydraulic System

Engine field is a custom field implemented using Field Api and it does have these subfields :

Make
Model
Net Power
PTO Power
Aspiration
Power Measured At
and ...

After that to make this field visible in feeds mapping hook_feeds_processor_targets_alter was implemented.

Here is the code :

foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance)
{
    $info = field_info_field($name);
    unset($callback);

    if ($info['type']=='uceen2wdtractor')
    {
        //The callback for this field type goes here.
        $callback = 'TARGET_SETTER_FOR_en2wdtractor';
    }

    if (isset($callback))
    {
        $targets[$name] =array(
            'name'=>check_plain($instance['label']),
            'callback' => $callback,
            'description' => t('The @label field of the node.', array('@label' => $instance['label'])),
        );
    }
}

Data is imported to Feeds using json files , An importer is provided with these settings :

finally this is my json file :

The Problem is no data is stored in Engine field . this is the dsm($node) in hook_node_presave :


texts: Truncate tables before uninstalling a module in Drupal 8

texts:
I'm developing a module in Drupal 8, and because it handles quite a few relations between entities, I always need to add a bit of test data before being able to test the forms for the actual entity I'm working on after a uninstall/reinstall of the module. During install I can add this data in the module.install->xx_install hook. But during uninstall I get the error

"The following reasons prevent the modules from being uninstalled: There is content for the entity type..."

I tried implementing the uninstall hook and truncate the table there, but it seems the check for existing content is done before this hook runs. How can I truncate the necessary tables without having to do it manually? Having to do it manually slows down development quite a bit. Alternatively, is there a way to speed up development of the entity forms and relations so that I don't always have to install/uninstall the module to see changes?


texts:
I want to import XML data from a remote server. The Feeds module has to interact with an API that outputs the data in a XML format where the actual content is in JSON format. Here's an example of the XML file:

<serverResponse>
  <status statusCode="0">OK</status>
    <messages>
      <user/>
      <tech/>
      <alert header="_*Alert*_"/>
    </messages>
  <content>
    {"appointmentSet":[{"appts":[]}],"bookingAllowed":false,"maxBookAheadPeriod":25}
  </content>
</serverResponse>

What I try to achieve is to let the Feeds module grab the <content> data and put it in a node text field. Then I want to use the drupal_json_decode function to decode the JSON data in readable text.

In my XML Xpath parser settings I've used //content for the Context value. But I've no idea what to do with the processor mapping. Can someone please help me? Does the Node processor mapping require a unique identifier for the GUID or is this not mandatory?


texts: Deleting a field from a content type deletes the view where that field has been included

texts:
Have started to play with Drupal8 recently by trying to jump from D6 to D8, skipping D7 part. While playing, have tried to re-create a simple slideshow view, using a separate "slideshow" content type and an existed image field.

Since an upload via old image field hadn't worked, decided to delete and re-create that field after slideshow view was created.

But, it seems, that Drupal has deleted not only an image field from a content type, but a View, where that field were included.

Has anyone seen something like this, or is there anything wrong with my configuration?


texts:
I have a content type of invoice. This also has a drop down list (list text) to let the user pick one of three types - receivable , payable and proforma.

I also have it so I'm getting the amount, vat and total of the invoice.

However, what I need to do is change the value of the invoice amount, vat, and total when the user picks payable from the drop down menu to a negative value. For example, I fill out the invoice make it payable and I enter 2000 in the amount, 230 in vat and 2300 in total fields. I need these values to become negative when I run aggregator plus on them so instead of adding these numbers it subtracts them instead.

I was wondering if I can do this using rules, or do I create a new module to do this, or if I add a function to the template.php file. Any ideas of what is easiest and best


texts: Adding content with existing installed module

texts: I have uploaded a Flipbook module designed for Drupal, and activated the module but can't find anywhere how I can insert that module (flipbook) content into a page.  It would be a simple shortcode with a wordpress plugin, but Drupal isn't that simple.  Can anyone give me an idea of how I can achieve this?  I basically want to create a page named "catalog" where it displays the flipbook module content which is a product catalog.   Any help would be appreciated, thank you.


texts: Showing list of nodes related to logged in user using views

texts:
I have some content of content-type "mockup". The "mockup" content-type has a field that references a user (so when I create a mockup, I can select a user for it to "belong" to).

For some reason, I can't figure out how to use views to get all "mockups" that belong to the logged in user. I thought it would be in "contextual" but I don't see anything like that.

I don't want anyone to be able to view the node unless they are the "related user", is this a "views" thing or a "permissions" thing?


texts: How to add js code in the head using a function? For a single page

texts:
How can I add a js code in the <head> for a single page using a function?

I found this module https://www.drupal.org/project/js_injector but it seems overkilling just for this.


texts: How to add Vue.js validation attributes to input elements?

texts:
I've seen a tutorial about enhancing Drupal's elements using Vue.js validation component. The input markup is like this:

<input class="username form-text required" autocapitalize="none" type="text" id="edit-name" name="name" value="" size="60" maxlength="60" v-model="name" v-validate.initial="name" data-rules="required|alpha|min:3">
<input type="text" id="edit-mail" name="mail" value="" size="60" maxlength="254" class="form-text required" v-model="mail" v-validate.initial="email" data-rules="required|email">

But how do I add the Vue.js custom attributes to these input field?


texts: How do i skip a row from a CSV based on the value of 2 fields within the CSV file?

texts:
I have a CSV file that contains about 200 records/rows.

ID, OrgID, EstabID, OrgName, Address

1, AB234, AB234, ABC corp, 123 Main Street
2, AB234, 8989, ABC Corp-West, 456 Better Street
3, 4858, CD323, First Tech Org, 9087 East Birdway

I would like to get the value of OrgID and EstabID and and if they are the same then id like to do something in a custom plugin like add the row to the migration or omit the current row to the migration. (If no plugin already exist)

1, AB234, AB234, ABC corp, 123 Main Street

I may be missing something but I cannot seem to find this type of functionality in one of the "process plugins" provided by Core or Migration Plus.

So to sum things up, how do you get the value of two fields and do something with those fields in a process plugin, if not then is there a similar functionality already in core i could build on?


texts: Trying to use drupal_http_request to get an admin page

texts:
I would like to render an admin page in a popup, I thought I'd use the ctools api to render the popup and drupal_http_request to get the data for the page, however even when logged in all I get is an 'unauthorized' error.
Looking deeper, I think there might be a way, as the function is reputed to support basic authentication, but I can't figure out how to make it work.
This is for Drupal 7.x
Or if there's a different way to render an admin page in a popup that'd be nice too. It's for a client who doesn't want to go back and forth between admin pages so the popup would solve the problem.


texts: list of cities and international airports

texts: Drupal has the built in option for forms which provide complete list of countries. What if we require a complete list of cities for each country and the list of international airports. Do we need to insert that all manually, or there is a way to aggregate it from other sites.


texts: How to change the field type of existing fields?

texts:
Here is my case.

I've created a content type with few fields (all fields had type:
'text').
I've exported this content type using feature and then used feature on PROD website for few weeks.
Recently we decided to change type of 2 fields to: 'email' and
'link' (first we deleted these 2 fields, and then created them with
new type), I've updated feature with my content type again (since we
did changes to these 2 fields).
Now when I do deploy to my website it says that it can't convert
fields form current type to new type (and I can understand that).
However I also believe it is something that everybody does, so there
must be a normal solution to this.

Here is a message from my terminal:

  WD php: FieldException: Cannot change an existing field's type. in
  field_update_field() (line 234 of
  /Users/aaa/git/drupal/http/modules/field/field.crud.inc).
  [error] Drush command terminated abnormally due to an unrecoverable
  error.
  [error] FieldException: Cannot change an existing field's type.
  in field_update_field() (line 234 of
  /Users/aaa/git/drupal/http/modules/field/field.crud.inc).

Please advise what is the good approach to solve my issue (change type of field that is used already).


texts: How can I have an account before registration?

texts:
I want to make site on Drupal 8 about some events. For every past event I shall have some information, including people, who was leading that event. But they shuld be able to register on that site, and than I want to link their real profile with profile I created to show their activity on past events.

I know how to make it on Drupal 7. I was trying to make beta on Drupal Commons, and there was function for merging accounts. However not Drupal Commons, not merge module are not available on Drupal 8. But I belie it is time to make thigs on new Drupal 8, and I like lot of new features of it.

So, how to achieve same result on Drupal 8? Profile2 module are missing for Drupal 8 too. I have an idea to make separate entity for people with information about their personal info and events thy was leading in past, and just make connection them one-to-one to user accounts? Or there is a better way?

What is the best solution?


texts: how to prevent javascript from running again when an AJAX form is submitted

texts:
I have this code in a javascript file to hide some search filters...

$('#views-exposed-form-faceted-search-page .form-type-select').once().hide();

The user can toggle the visibility of the filters by clicking on my #advanced-search link...

$('#views-exposed-form-faceted-search-page #advanced-search a').once('advanced_search').click(function(){
        $('#views-exposed-form-faceted-search-page .form-type-select').toggle();
});

It works, but when the AJAX form is submitted, the hide() function runs again and the .form-type-select elements are hidden.  How do I prevent them from being hidden a second time?  I only want my code to hide the selects when the page first loads.


texts:
I have a custom search form on my website that pulls data from a 2nd drupal site, and the form utilizes AJAX to show results as the form is being filled out. I'm using a pager that also utilizes AJAX.

I also have a second form on the page that sends empty values to the submit function in order to "display all".

The problem is that with 2 forms on the page, the pager links don't do anything. They look correct but don't respond. If you do a search and then refresh the page, the 2nd form is no longer on the page and the pager works fine.

You can try it out here: http://www.adoptionhelp.org/find-a-family.

How can I get this pager to work for either form? Or, barring that, how do I otherwise create a "view all" button to submit empty values on my form?


texts: How do I programmatically create an entity with its fields?

texts:
I'm using Entity API to work with some entities but I cannot figure out how to create a new entity with its fields attached.  I created a bundle and added some fields to that bundle.  I'm looking to do this:

$a = entity_create(...);

return an array:

isNew => TRUE,
title => '',
attachedField1 => '',
attachedField2 => '',
etc...

I'd then like to be able to simply update the values and then entity_save() them:

isNew => TRUE,
title => 'Title of my entity',
attachedField1 => 'data for attached field 1',
attachedField2 => 'data for attached field 2',
etc...

Is this doable?  If so, how?  I'm having a tough time working with entities.

Here's my entity info:

  $return['k_profile'] = array(
      'label' => t('Profile'),
      'entity class' => 'Entity',
      'controller class' => 'EntityAPIController',
      'base table' => 'k_profile',
      'fieldable' => TRUE,
      'entity keys' => array(
        'id' => 'pid',
        'bundle' => 'type',
        ),
      'bundles' => array(), //added later in hook_entity_info_alter()
      'bundle keys' => array(
        'bundle' => 'type',
        ),
      'label callback' => 'entity_class_label',
      'uri callback' => 'entity_class_uri',
      'access callback' => TRUE,
      'module' => 'k_profile',
    );


texts: drupal 7.14,where to install a new module,it is different than 7.13

texts: There is a  button in 7.13 on the top of the module menu,but it dispears in the new 7.14,I'm implementing a new drupal installation not upgrate from 7.13.Thanks!Where to find this button?


texts: Should I call a function to query the database in a custom content type template?

texts:
I am calling the following function inside a template for a custom content type, but my senior developer suggested that calling a function inside a template file is not Drupal standard.

function some_function($AA_tid = 0) {
  $dis_pt = db_select('some_tble', 'v')
    ->fields('v', array('title'))
    ->condition('some_fld', $AA_tid)
    ->distinct();
  $dis_pt->join('another_tble', 'ss', 'v.title = ss.type');
  $dis_pt->fields('ss', array('name'));
  $result = $dis_pt->execute()->fetchAll();
  return $result;
}

Should I call the function which will query the database from a content type template? Generally speaking, is it better to avoid such code in a template file?

Edit: function call is present inside the template & its definition is available in some module file.


texts:
I used custom module to alter comment form.in that module i write below code to remove required option for fivestar rating field. but it is not working.

$form['field_rating_comment']['und']['0']['value']['#required'] = FALSE;
$form['field_rating_comment']['#required'] = FALSE;

both are not working.


texts: I'm using Drupal 8, with a view of type Log entries. I'm trying to rewrite the output so it adds additional text but the field is already formatted by the time it gets to the twig file. Where is the field being rendered? I'd like to override the rendering for just this field in just one view. Thanks.


texts: Managed File is stuck with a temporary URI, even after saving it as permanent file

texts:
I was having this problem: Files uploaded via custom configuration form are eventually lost.

So, I used the solution, basically:

$file->setPermanent();
$file->save();

But then, even thou $file->isTemporary() is FALSE, the URI and URL seem to indicate that the file is still temporary:

URI: $file->getFileUri() yields temporary://filename.jpg

URL: file_create_url($file->getFileUri()) yields /system/temporary?file=filename.jpg


texts:
I have a view setup with contextual filters to display articles on a block based on node tags. The contextual filter is based on 3 taxonomy vocabularies (ex. A, B, C), each with multiple terms. The default sort order for the view is based on post date.

How can I make a sorting rule that will use A taxonomy with greater precedence than the other two?
I want to display articles that have a match (with the node) on A taxonomy before all the other articles that have a match on B or C taxonomies.

This starts as a classic related articles block, but I want to be able just for some nodes to specify some specific articles (mapped with A taxonomy terms) to appear just on those nodes on top of the article list.

Thank you. I’m using Drupal 7, Views 7.x-3.7

EDIT: I feel that it might be needed a more in depth example of this behavior. So we have:

node/1 (with taxonomy vocabularies/terms as follows (for simplicity I'm omitting C))
 | A => red
 | B => apple, lemon

node/2
 | A => blue
 | B => apple, lemon, grapefruit

article/1
 | A => green
 | B => apple
 | post date: 2014

article/2
 | A => red
 | B => apple, lemon
 | post date: 2013

Considering the above contextual filters setup, if I have a block listing articles on each of the nodes I will get the same ordering for the articles (1,2) based on date.

What I want is when I'm on node/1, the article/2 to be on top of the list (based on A taxonomy matching), but when I'm on node/2, the regular sorting by post date should apply.

Practically I'm dealing with the same articles listed on all nodes, just the sorting/ordering should be changed based on A taxonomy.


texts: Can I create a view of watchdog log entries?

texts: We want to view a more detailed view of watchdog log entries, filtered by module and level and showing the details section in a table. When creating a new view, watchdog logs is not in the list. Is there a way to do this like a Views3 plugin or something what would integrate this?


texts: Individual CCK Imagefield promote-to-front

texts:
At the moment, my view creates a gallery of images by fetching all images across multiple node types. What I need is a way to indicate which images should be used in the gallery. So, instead of my view simply displaying all images, I want the client to indicate which image they want to "promote" to the gallery.

Can anyone help please?