texts: How do I remove the colon from a form element's title - D7?

texts: I've hunted high and low for what generates this colon. I've looked in thetheme_form_element_label function and at the #title_display attribute in the form api, but I cannot see how to override it. It must come from somewhere? Thanks.


texts: Drupal 7, Rules, Convert text to date and set a date field

texts:
I've some string like "11/28/2012" and i want use to populate a date field in my nodes/entity. In rules i use "set a value", select the date field and add php code:

$mydate = field_get_items(($entity_type, $entity, 'field_textdate');

$value = date('m-d-Y', $mydate);

return $value;

But when i execute the rules, i get
46.397 ms Unable to modify data "node:field-datone": Invalid data value given. Be sure it matches the required data type and format.
57.754 ms Unable to evaluate action data_set.

How can i do?


texts: How can you compute grand totals in an aggregate view

texts:
I have a aggregate view in D7 that is working great.  The only thing is, I want to add a grand total line to the view.  What is the best way to add a grand total to the view?  Here is a sample of my data.

Dept  Squad    # of Rpts   # Vols   # of Hours  Value of Hours
AK     AK-11        3          6        124.00           2,745.36
FL    FL-893       24         41        664.50          14,712.04

What I would like to do is the above plus a grand total line like:

Dept  Squad    # of Rpts   # Vols   # of Hours  Value of Hours
AK     AK-11        3          6        124.00           2,745.36
FL    FL-893       24         41        664.50          14,712.04

  Grand total      27         47        789.50          17,457.40

Any suggestions?

Thanks for you help.

Dennis


texts: Modifying Page Title To Be Separate From Browser Title

texts:
I have a module that contains multiple forms, each form in its own file. I need to modify the page title such that it is different from the browser title for several of these pages. The name of the module is member_login. This is what I have so far:

function member_login_preprocess_page(&$variables) {
  if (\Drupal::routeMatch()->getRouteName() == 'member_login.login') {
    $variables['content']['#title'] = t("The new HTML title.");
  }
}

I add this function to the .module file. Do I need to call it, or does Drupal call it automatically for it to come into effect? Currently, I do not see it into effect.


texts: How to attach images in field collection to node using feeds

texts:
I'm using feeds and xpath_parser to import content to my site. I have two directories in my private directory called articles and photos. The xml is in the articles and the photos are in the photos. I have a content type called articles which has an unlimited field_collection containing photo and caption. When the feeds module parses the xml it will get a list of photos and captions that should attach to that field collection. Everything other than the images are working. The errors I get are:

  exception 'Exception' with message 'Download of 8084413.jpg failed with code -1002.' in /var/www/html/sites/all/modules/feeds/plugins/FeedsParser.inc:324

and

  exception 'Exception' with message 'Invalid enclosure 8084413.jpg' in /var/www/html/sites/all/modules/feeds/plugins/FeedsParser.inc:389

and

  Notice: Undefined variable: file in FeedsEnclosure->getFile() (line 388 of /var/www/html/sites/all/modules/feeds/plugins/FeedsParser.inc).

I'm using the latest dev versions of all modules involved. Any help would be greatly appreciated.


texts:
I am using apachesolr, apachesolr_commerce, apachesolr_autocomplete for search functionality in drupal 7.
Commerce Product is not visible for anonymous user in search result but when loggedin Commerce Product results are including into search results.
Any suggestions?


texts: How to retrieve all nodes for a taxonomy term using Services?

texts:
I want to retrieve all the nodes associated with a given taxonomy term (field_term) using HTTP GET.

I have tried:

curl -v http://myserver/endpoint_path/node?parameters[field_term]=1

but I get an HTTP 406 Column not found.

Also later on I will need to use multiple taxonomy vocabularies to filter by more than one term.

I am using the Services 3 module in Drupal 7.


texts: How to count the children (elements) inside a fieldgroup?

texts:
I use the Field Group module in a website and I'm trying to count the fields within a Field Group.

I tried …

$num_of_fields = count($content['group_name']['children']);

echo $num_of_fields;

… but it doesn't seem to work. What am I doing wrong?


texts: Remove drupal parameters from form submitted via POST

texts:
When I submit form created with Form API, the POST variable contains values like form_token, form_build and form_id.

The problem is, I need to send submitted form values to external website. Is it possible to remove such values from POST request?

In particular, I am implementing redirection callback to commerce payment method

This callback is defined within Drupal Commerce. The callback works OK, but how can I remove the mentioned form parameters? (The third party payment service does not accept them in received POST variable).

I am not sure whether I can just unset them in hook_form_alter. This callback is just part of the order process and I am not sure if I  can just unset it.


texts: An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. When updating modules

texts:
I am getting the below error after updating and activate some modules:

  An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=323&op=do StatusText: Internal Server Error ResponseText: {"status":true,"percentage":"100","message":"Completed 1 of 1.\u003Cbr /\u003E"}

when I am trying to update the modules and later trying to activate some module, the site crash and I have to restore it with a database.

Please help, I am using Drupal 7.64 version


texts: Is it possible to use different tokens in metatag based on content type

texts:
Lets say I have the summary field enabled on article type but not on page type and then I setup meta tag descriptions to use the token [node:summary] would is be possible to do something like if [node:summary] doesn't exist or is empty than use [node:body] ?

Otherwise i was would most likely need to add the summary field to page types and fill the summary field for all the pages that didnt have it.


texts: How to create a relationship between a table in a database and content type in views d7?

texts:
A table table_A is present in database with a abc_nid and abc_code columns.
I have  a node having abc_nid as node_nid
How can I link a abc_code (from the table_A) in a view using relationship(non programmatically) or any other way ?


texts:
I need to create a slide in popup where the user can list the galleries.

In short, the left and right arrows is navigation for previous and next gallery (as well as numbers for navigation), each gallery has a number of images that can be changed by clicking on the thumbnail image.

My idea is to create a content type for the gallery, and then using Views Slideshow to list only body of that content type. Is such a thing possible? Could there be another way in which this can be done?

Any suggestion is welcome...


texts: Render the first image of an image field which allow to enter multiple images

texts:
I have a template file for my blog page that renders a single image when the blog posts are listed. Originally, the field was for a single image, but it has been changed to accept more than one image and render only the first image. I would like to do within a template file instead of a view.
In that template file I used the following code, which doesn't work anymore since the image field has been changed.

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

Instead of that, I tried the following code, which doesn't work too.

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

How should I render the first image of a field that accepts multiple images?


texts: How can I highlight only the contents that have been never published yet in the Views?

texts:
The contents always need approval of administer to be published on this site.

For example,
The contents are once unpublished by Rule module when non-adimin users update them.
And then the administer publish those contents again.

I have a node View with table style.
In this view the administer wants to find "The contents that have never been published yet" easily for example, by making them hi-lighted.

Is there any way to achieve this?


texts: How to create an "Apply"/"You have already applied" functionality

texts:
I have been batting with coming up with a way to include a functionality that is critical to a job board-like site I am building. I have tried a couple of things that do not completely satisfy my own case:

1) Use Flags - and an action ('redirect to url') to send the use to the job application create page. Additional I set the off flag (once you click on the link) to say "You have already applied" and made it so that link was disabled for that user. The trouble with this approach is, a user could click on the apply link, have the job application node create form open, and then change their mind and not complete the form. The original job ad would still indicate that they had "already applied for the job"
2)Use Node Reference - I linked the job application to the job node; well and good, but here I could figure out a way to disable the link (and put up the "You have already applied" message/disabled link) after the user created and submitted their application.

Additionally I tried various permutations of Rules/Rules Link... but I still have found joy.

So basically, I desperately looking for help to to do the following is: An "Apply for this job" button/link, that sends user to a job application page. On completing and submitting the application the user is sent back to the original job page where the link is now "You have already applied" and is also disabled for that particular user.

I am at a beginner PHP level....


texts:
I am using a custom theme with Stable as a base.

I am trying to figure out how to set the <title> tag and I'm having a hard time.

I noticed in html.html.twig there is the following:

<head-placeholder token="{{ placeholder_token|raw }}">

How does the page title find it's way into the above?


texts: What does 'op' exactly mean in an submit button?

texts:
In the form_state['values']['op'] = t('Save');

What does 'op' exactly mean and do ?


texts: Messed Up Drupal Site, truncated all cache, menu_router, registry_file and now I can't access site

texts:
After disabling comment module, I could not access some modules, so I researched how to get that fixed and end up following this. I cleared all the cache_table, menu_router and registry_file.

This is the exact command I ran:

TRUNCATE `cache`;
TRUNCATE `cache_block`;
TRUNCATE `cache_bootstrap`;
TRUNCATE `cache_entity_og_membership`;
TRUNCATE `cache_entity_og_membership_type`;
TRUNCATE `cache_field`;
TRUNCATE `cache_filter`;
TRUNCATE `cache_form`;
TRUNCATE `cache_image`;
TRUNCATE `cache_libraries`;
TRUNCATE `cache_menu`;
TRUNCATE `cache_metatag`;
TRUNCATE `cache_page`;
TRUNCATE `cache_path`;
TRUNCATE `cache_token`;
TRUNCATE `cache_update`;
TRUNCATE `cache_variable`;
TRUNCATE `cache_views`;
TRUNCATE `cache_views_data`;
TRUNCATE `menu_router`;
TRUNCATE `registry_file`;

Now I have an empty site, I can't browse or go to anywhere. Even the front page Gives page not found error saying "/" not found.

I tried to rebuild the menu and registry with these commands but it didn't work.

chdir('path/to/site/root');
define('DRUPAL_ROOT', getcwd());
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

registry_rebuild();
menu_rebuild();

I tried with drush using drush cc all but it says

  No Drupal site found, only 'drush' cache was cleared.
  but drush status shows it find the site

 Drupal version         :  7.23
 PHP executable         :  /usr/bin/php
 PHP configuration      :  /etc/php5/cli/php.ini
 PHP OS                 :  Linux
 Drush version          :  7.0-dev
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /path/to/site/root

What can I do? How to get the site back after this?


texts:
I have a twig file with the following code in my Drupal 8.4.4 site:

{{ node.field_date.value }}

And in my content type, manage display option, I have it formatted like this:

But on the website, it shows the date as

2019-01-16T23:00:00

What am I missing?


texts: How can I use Migrate API to migrate taxonomy with an unknown level of parent child relationships in tact?

texts:
I have a JSON file with an entry that looks like this:

"taxonomy": "abc/historical_controls/abc2000_2013"

In my YML file I have it mapped like this:

  field_abc_asset_taxonomy_auto:
    -
      plugin: skip_on_empty
      method: process
      source: taxonomy
    -
      plugin: explode
      delimiter: /
    -
      plugin: callback
      callable: ltrim
    -
      plugin: callback
      callable: rtrim
    -
      plugin: entity_generate
      value_key: name
      entity_type: taxonomy_term
      bundle_key: vid
      bundle: abc_asset_taxonomy_auto

This works in that it brings over the terms correctly, but in a flat file. I need them to come over so that each term is a child of the term before it so:

abc
    historical_controls
        abc2000_2013

The problem is there is an unknown number of items. It could be 2, it could be 10.

Is there a way to migrate hierarchical taxonomy with an unknown number of parent child relationships?

Note, I've seen several examples that use a determinant number of sources but this wouldn't work here. The "Migrate Hierarchical Taxonomy" module uses a determinant number as well.  How can I achieve this with the Migrate API preferably without writing a custom plugin?


texts: Displaying a Value while linking a Key with the Linked Field Module

texts: I am using the linked field module to try to display a particular field as a link on a content page (I am not working within a View).  The field is a select list with associated urls in the key.  For example, the Value "Accounting Department" may have a key of "/drupal/accounting".  I want the link to show "Accounting Department" but map the link to what is in the key.  If I map to the field with this module, it tries to go to "/drupal/Accounting Department".  Has anyone else attempted something like this or is there another module that will allow this?


texts: Permission settings for Edit Node Link to show up?

texts:
I have a view that includes the Node: Edit link field. When the view gets rendered and the user is logged-in, only an Admin can see the link. What permission settings do I need to have enabled for that link to show up in a role with custom permissions?

Additional details:

Edit link was added to view in the standard way. See screenshot:


texts: Count quantity of specific product in views

texts:
I'm using Views and Views Data Export to create a downloadable CSV of store orders logged in Commerce.

I want to create a column that counts the quantity for a specific commerce product (defined by SKU) in the order (so needs to go through line items).

Any ideas of how to do this?


texts:
When I visit a page that does not exist, I expect to still see the primary and secondary links as on any other page, but what I get is no navigation links in the 404 page. See also No navigation links on 404 pages.

I have found a solution, but I am happy if something else can fix this (possibly without using extra modules).


texts: Taxonomy term custom view page for all sub terms

texts:
I have taxonomy called Sections and it has several terms,their children and grand children.
How can i set same display page or display format for all the sub section pages irrespective of their depth.


texts: The Batch API won't continue running if the browser is closed correct? Can a batch be run with Drush?

texts:
Can the batch API continue to run once the browser closes? If not then can I run a batch with Drush? I have an insane amount of data to migrate and I don't really have time to wait for it to import every item one at a time on my local machine.

Currently I have my batch process setup to import each item (groups, users, blogs, files, etc) one per op call. But I am going to change that to do 50 to 100 per call to improve the speed. But I just ran it last night on just my groups and it took almost an hour to run on almost 800 groups.

This is part of a data migration from multiple websites to one unified site. Thoughts? Suggestions? Can Drush help me out?

EDIT: I have rolled my own export/import scripts for this because of the nature of the migration (multiple Drupal 4.7 sites that are highly customized and with potentially hacked cores to Drupal 6). I already have the exported data file created and ready to go. I am just testing the import portion of this madness.


texts: Get language path prefix code as contexual filter parameter

texts:
In Drupal 7, I have a block that shows recent posts which created with views.

I want it to show the translated posts of each language when I click the language switcher to switch the language.

I have two language prefixes (url code):
'en' and 'fa'
mysite.com/en
mysite.com/fa

I set in a contexual filter of that block view to show just the nodes of the specific language by raw value from url set to 1, but it considers the next value of language code as the first parameter.

What should I do to make Drupal consider the language code as the first value?


texts:
I created a blog site and I used the Display Suite module to create a layout for the article content type. In one of the regions I created a custom code field that had "Posted by [user:name] on [node:created:long]".

After creating it I noticed that only the date was showing up and not the user token. I tested this out with several of the user tokens and none of them seemed to work. The only thing I can think of is that users tokens aren't supposed to work in Display Suite, but I couldn't find any proof one way or another.

The second issue is involving the number of views to a particular node. When I go to drupal.org, there is a list of tokens. The one I am trying to use is [node:source:total-count], but nothing appears. I read that it might be a more in depth process than a simple token.


texts: Sharing files privately individual users

texts: I'm trying to create a Drupal 7 feature whereby an admin uploads multiple files that are only visible/downloadable by a specific user. These files would be visible on the user's profile page or (alternative) a document page where a user would only see the files available to them. Ideas?


texts: Block overriding with template file doesn't work

texts:
The Drupal version I'm using is v7.34. I'm using sub-theme created from Bootstrap as base theme.
My problem is, I want to override the "User Login Block" and put it in the header region (top bar), so I create these file in templates folder in my sub-theme:

page.tpl.php

//this simply do
print render($page['header']);
region--header.tpl.php

$search_block = module_invoke('search', 'block_view', 'search');
$login_block = module_invoke('user', 'block_view', 'login');
print render($search_block);
print render($login_block);
search-block-form.tpl.php

//this copied from base theme and only modified some html tag
block--user--login.tpl.php

//this simply print out some simple text
print ("blahhhhhhhhhhhhhh");

The result is, only search block is rendered as override, and the login block is rendered as default block, not rendered as the one I override.
I did some search but nothing matches my fault.


texts: How to scrape specific elements of the Drupal theme to a file?

texts:
I want to save two divs - one with the site header and the other has the main nav menu - to a PHP file that can be used in other (even non-PHP) sites to replace their header and menu using Javascript DOM insertion and CORS with a header on the saved file that allows cross-origin resource sharing.

The idea is to update the distibution code automatically on cron or on demand, when changes in the menu are made, so they will be reflected in the satellite sites.

I have been able to create a working proof-of concept using simplehtmldom on the current version of our site. However, when I tried to adapt it to the new version in dev, using a different theme as a subtheme of Adaptive Theme, then simplehtmldom cannot read the URL properly - it seems that the blocks are missing see https://drupal.org/node/2139613

The divs are not $page regions, although the header-wrapper div contains the $page['header'] region (and the region is invisible to simplehtmldom).

I looked at the Web Widgets module, but that is for content and views - I want to get the theme elements in the header-wrapper and the nav-wrapper, two arbitrary divs at the top of the page.

It's also frustrating that I cannot access the $page array or even the $variables in my module. I had to set the module weight to 1 to be "heavier" than the simplehtmldom module, since there are other modules that require simplehtmldom module (like devel themer) and I don't want to load its library twice. But I tried the latest simplehtmldom library separately, with the same results.

I know there are scraping tools based on node.js but I'm looking for a more lightweight solution. simplehtmldom worked, but in the new site it doesn't


texts: How to theme checkout completion page in Drupal Commerce

texts:
I'm having a problem with theming the checkout completion page. My designer gave me a layout that will show all of the order details in that page(nearly same as the checkout review pane). I already googled it and all of the links that I tried is not working. Please see the links below

theming checkout pages in Drupal commerce
http://theoleschool.com/blog/templating-commerce-order-completion-pane

Is there any tpl.php file that I need to include? or hooks to achieve my goal?

Thanks GUys


texts:
We have an old site running Drupal 6. When we try to upload a file via the interface, the ajax uploader spins, and reloads the "Choose file" dialogue.
Checking the recent error log I get:

The file upload failed: field_small_banner_0

If I go into the location URL (?q=filefield/ahah/gallery/field_gallery_image/0) I get:

{ "data": "\x3cdiv class=\"messages error\"\x3e\nAn unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (64 MB) that this server supports.\x3c/div\x3e\n" }

I've seen mentions of ModSecurity but this is not active. I've checked the permissions of the files folder and this is 777.

I've checked phpinfo for the temp folder and that's set to /tmp

Many thanks :)


texts: Views Slideshow alternating blank screens with content items

texts:
Views Slideshow with JQuery Cycle had been working successfully for a long time, displaying a cycling set of 8 photos with cross-dissolve transitions. Now it's displaying a blank screen between each content item, for the same duration specified for those items in Views>Slideshow>Settings. All content is being displayed, nothing skipped, and transition is correct. But it acts as if a blank item is alternating with the intended content. I tried going back to earlier versions of Views and JQuery but there was no improvement in this problem.

Suggestions on why this might happen and how to fix? Thanks.


texts:
How to allow authenticated users to see all versions of images but prevent anonymous users to see 'large' images created with an imagecache preset?

I've ticked the correct boxes under the permissions tab of imagecache so that anonymous users aren't able to see these images but still they show up.
What am I doing wrong? (I've flushed the cache of the imagecache)

Cheers.


texts: Exclude content referenced by content whose author is current logged in user

texts:
I try to solve question - answer scenario with views.
2 content types: question and answer. (answer is connected to question by entityreference)
User can check themes of interests (taxonomy) in profile and a view is displayed in his profile with relevant questions. Creating this view was simple: I made a user view with UID as contextual filter and added a entity reference relationship and taxonomy term:content with term. Then it is easy to display list of relevant questions.

Problem: I want to filter out questions already answered by current user. In other words - to filter out all questions which are referenced from answer content type and answer's author is current user.

I tried to add new relationship - content referencing content from xy field, tried to add contextual filter - node author. None of this seems to work.
EDIT: adding contextual filter user:author with excluded option works ONLY if there is reference (answer) made by current user. If other content(answer) by other user is referencing the content(question), it shows the question in the list again. Of course, because context filter only removes current user's nodes.

I need views to exclude content by other users as well. Does someone know answer to this? thank you


texts:
Let me explain my situation. I have in D7

4 different taxonomy list. Each taxonomy list is connected to other data in the system
A content type cFoo
2 different roles : contentmanager (CM) and user. hhahaha what else is new :-)

The CM is creating a entityque based on taxonomy terms which will result in let's say: tlist.

The user should select for an cFoo a term from tlist but if he used a term already in another cFoo he may not select it again.

I did testing and research but do not get the complete puzzle complete... I thought about the following solution for the user.

Build a webform with a selectbox with values of tlist. Contextual reference to this form will be cFoo.nid. Before loading this list in the webform it should already be filtered. Let say we have another view with terms already used named tListUsed. After the webform I will implement a rule to submit the selected term to the cFoo.

So now I have two views. tList, tListUsed.
The basic question was: How to filter tList with view tListUsed?

UPDATED QUESTION
With the help of flags modules and views_exclude_previous modules i do not got this problem working. There is a approach on:
https://www.youtube.com/watch?v=cQrw7Ydo1to
which I now try to implement.

The strategy is now as follows:
Load the list of tListused into a global var. Use this var as a contextual filter with multi values to exclude.

On which hook should I execute the building of tListUsed. It cannot be in the view itself as it is a filter to the view.

ps: question edited as setting up the tList for the CM is working and after trying some modules.


texts: How do I get the generated HTML ID of a form element?

texts:
I have fields called

'title'
'field_article_summary'

The HTML IDs of the form elements are

edit-title
edit-field-article-summary-und-0

Is there a way to programmatically get these HTML IDs? (without writing the code myself to do it - Drupal must have something that is creating them)


texts:
I'm a wordpress user and I was wondering if Drupal has the ability to let coders modify the output, or return value of a function trough filters.

(in WP you can do this with add_action / add_filter)


texts: How to disable the title field on the node edit form?

texts:
How can I hide or disable the title field on the node edit form?

If I do so from the content type Manage form display tab (admin/structure/types/manage/CONTENT_TYPE_MACHINE_NAME/form-display), then I get some integrity constraint errors in the log.

So I don't want to show default title field in Node edit form. If I hide the title field normally like other fields. Got white screen after node creation. And log says title field can't be null .... and so on ...


texts: Migration from source YML: implode all values of each array element nested inside an parent array

texts:
We are trying to pull in some data from an outside source that serves JSON.

The structure of said json is like this:

[
    {
        "name":"something",
        "desc":"some kind of desc.",
        "tags": [
            {
                "order":"3",
                "displayName":"Tag1"
            },
            {
                "order":"13",
                "displayName":"Tags 101"
            },
            {
                "order":"28",
                "displayName":"Dogs"
            }
        ]
    }, ...

]

We want to implode all tags.displayName values into one string.  I'll use the body field as an example.
In the UI, if you view the content, "body" would be:

Tag1|Tags 101|Dogs

In the "fields" section of my migration source yml file:

name: tagsCollection
label: "tagsCollection"
selector: tags

Then, in the process section of the YML file I've tried this:

body:
    plugin: concat
    delimiter: "|"
    source:
     - stepsCollection

I've also looked into the iterator plugin.  Nothing seems to click.

If I do this in the process section of the yml file:

body: stepsCollection

body will be "Array" in the UX.  So it is aware that there is an array in that var.

What am I missing??  Many thanks


texts: Multiple Databases & Backup Migrate Module

texts:
Without going into the details, our Drupal site actually has 2 databases that must always be in sync. That means if one is backed up, the other one needs to be backed up at the same time and that they would both need to be restored at the same time. (For the curious, one is Drupal and the other is for our CRM.)

I am using Node Squirrel to host off-site backups through the backup and migrate module so that if something happens to the server image, I'll at least have those.

When I look at my off-site back ups, I only see one .mysql file per day but I am backing up two databases.

How can I check and see if the .mysql file contains a backup of both databases and if it's only one database, how do I tell which one and make sure they are both backed up together?

Thanks!

Edit: My production server was corrupted and I needed to restore the last backup, but apparently it was only one and not both databases that were being backed up. Furthermore, my test and dev sites were also being backed up to the same location because I imported the Drupal database, which included my backup and migrate settings, to those locations so none of the back ups were dependable. I need to figure out the best practice for using this module: making sure test and dev sites aren't backing up to it and that it's backing up all my databases, not just one.


texts:
I need to get RDFa working with Panels.  As it currently stands, fields output with panels or panelizer will have their property fields set correctly.  You can see an example of this at http://schema.org/Product when you look at the bottom and view RDFa output.

The part that isn't working is getting all of the properties to be wrapped by their proper type, in this case Drug.  So at some point, all of the output fields need to be contained within a wrapper that has the attribute typeof="Product".

Panels has no support for this, but you can see an example of what it would look like if you looked at some sample node output.  The node container wrapper would look something like this.

<div id="node-121" class="node node--product node--full node--product--full clearfix" about="/products/sample-product" typeof="schema:Product sioc:Item foaf:Document" role="article" itemscope="" itemtype="http://schema.org/Product">

That's your typical RDFa output when rendering output with node.tpl.php.  Panels doesn't use this though, so it never gets rendered.

I'm hoping someone out there has dealt with this situation.  Structured data is pretty common to see these days, and so is the use of Drupal with Panels.  Someone has to have tackled this problem before, and I'm just looking for the best solution possible at this time.  Thanks.

TL;DR: What is the best way to get RDFa working with Panels?  Specifically, getting the typeof property added to some wrapper element which contains all of the other properties.


texts:
I want to add the following code in my  section of the front page using a Drupal 8 sub theme of Bartik.

Can anybody help how to do it? What is the best way to do it in this new twig version of theme? Where is page.tpl?

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="stepcarousel.js"></script>


texts:
I don't think I understand Drupal too well yet.  I have an article.  In the theme I chose it has the various blocks.  How do I put an article on a given block area of a theme?

I see the modules I can assign to a block in a specific region, but I have things articles I want to put in the block.  I don't need who's online, recent comments, etc.


texts: How do I code the header in AdaptiveTheme?

texts:
How can I code the header in AdaptiveTheme subtheme that it allows me to have the branding floating left, the navbar on the right etc.
I know that I can add some classes in the page.tpl that floats as I wish, but is this correct way to go?

AdaptiveTheme seems to promote the use of "regions", however when I add the Menu Bar in the "Header-region" it goes below the branding -- and the "nav" class is not applied to the menu bar. So it looks like a normal list, however If I place it in the Menu region it seems to look like a menu and the "nav class" is applied, where do I control this behavior?

What is the "correct" way to, add "grids" in the header, allowing for different navs/logo, etc.

I looked at panels, but quickly reading it seems to be focused on content rather than the layout structure, am I right or wrong here?


texts: How to reference existing term if it exists or create new one if not exist via Inline Entity Form module?

texts:
I have a content type book and it has a taxonomy term reference field: author.

I want to enter name and surname separately for each author on node add/edit page. Name and surname together will be the taxonomy term.

If I enter John for the name and Smith for the surname the taxonomy term will be John Smith.

I'm doing this by using the Inline Entity Form module with the Automatic Entity Label module.

The problem here is: the Inline Entity Form has two options while entering the term:

Add new term
Add existing term.

If you don't know if the term exists or not it become useless.

What I need is only one option and if the entered [name + surname] exist then select it as author automatically and if that not exist create a new term.

How can I do this?

(Similar structure can be created with some different methods such as References Dialog module, Entity Connect module etc but the main problem exist there too.)

Note: This question is not a duplicate of "How to create a name-surname structure for taxonomy terms?" ... even though they use the same image. In this question the main point is "how to combine creating new term and choosing existing one options", in the other question "how to create a name-surname structure on node form" is asked.


texts: Views Preview Shows Results, but Browsing the Path Doesn't

texts:
My site is running Drupal 8.9.3 with "Views taxonomy term name into ID" 8.x-1.0-alpha3 and "Hierarchical Taxonomy Menu" 8.x-1.x-dev.
I'm trying to create a view that shows Drupal Commerce products tagged with terms from a particular vocabulary. When editing the view, the preview shows the results I expect:

The problem is that I don't see these results when I view that path directly from my browser. The path resolves, but there's no content displayed:

What could be going wrong here?


texts:
I am working on a module that is transferring files from my old site (hosted on the same server) to a new drupal based site.  The files will be associated with a single content type (the content type has multipel file fields associated with it). I've written code to read a directory and then loop through the files, associating the files with the appropriate file file.  So far the files are getting transferred correctly, but they aren't being associated with the new node.  What am I missing

$result = new stdClass;
$result->type = "results";
node_object_prepare($result);

//add values to text fields here
...

//open the source directory
$d = dir($seasonDir);
while(false !== ($entry = $d->read())) {
      if($entry != "." && $entry != "..") {
        //set the file location
        $fileLocation = $seasonDir . "/" . $entry;
        //get the file contents
        $fileContents = file_get_contents($fileLocation);
        //save the file
        $file = file_save_data($fileContents,'public://results/'.$entry,FILE_EXISTS_RENAME);
        //store the file for copying to a subdirectory later
        $result_files[] = $file;
        //create an array to assign to the various file fields
        $file_details = array(LANGUAGE_NONE => array('0' => (array)$file));
        switch($entry) {
          case "results.inc.html":
            $result->field_results_html = $file_details;
            break;
          case"clubs.inc.html":
            $result->field_clubs_html = $file_details;
            break;
          case "events.inc.html":
            $result->field_events_html = $file_details;
            break;
          case "index.xml":
            $result->field_results_index = $file_details;
            break;
          case "events.xml":
            $result->field_results_events = $file_details;
            break;
          case "clubs.xml":
            $result->field_results_clubs = $file_details;
            break;
          case "results.xml":
            $result->field_results = $file_details;
            break;
          default:
            //because the resuls_files field allows multiple files, this
            //field has to use a different method of assigning the file
            $result->results_files[LANGUAGE_NONE][] = (array)$file;
            break;
        }
       }
    }
    $d->close();

    node_save($result);
    //now move the files to the folder using the node ID as the subfolder
    $newdir = 'public://results/' . $result->nid;
    if(file_prepare_directory($newdir, FILE_CREATE_DIRECTORY)) {
      //move the files into this directory
      foreach($result_files as $file) {
        file_move($file, $newdir . '/' . $file->filename, FILE_EXISTS_REPLACE);
      }
    }
    else {
      drupal_set_message("could not create $newdir");
    }

At the end, all the nodes have been created, the files have been moved to the correct sub directory, but the node doesn't show any attached files.  What am I missing?


texts: In Drupal 7 Views 3, is there a way to change "Access" under "Page Settings" to use a custom access function?

texts:
I have a senario where I would like Views to either allow me to use a custom Access control or allow me to specify some logic such as "This or This". So for instance, I could write a function

return (user_access('Permission 1') || user_access('Permission 2'));

Any suggestions?

Maybe a custom views access handler? If this is the option... anyone got a good link to an example access handler?


texts:
During Image upload, I get an 'Http error 0 occurred' when the file size is larger than the allowed maximum file size. Is this a correct behavior? and how would I provide a better error message. I have tried this in different browsers all show this message and changed settings in php ini file based on discussions on this topic.

Thanks for your help.


texts: My views slideshow doesn't work when the display is called from page.tpl.php

texts:
I am working on Drupal 6.  I have a view with a display block.  My view contains an animation of 6 images with slideshow as Style.

If I put the block in the content the view works fine, the images changes.  However, when I call the same block from template the images not change, I can see only one image.   What is my error?

my code is:

<?php
$block = module_invoke('views', 'block', 'view', 'images_home-block_1');
print $block['content'];
?>

Also, I tried this code:

<?php
print views_embed_view('images_home', $display_id = 'block_1');
?>

Thanks in advance.


texts: How to redirect to a certain page after logout from any link

texts:
Does anyone know how to redirect to a certain page like mysite.com/message-board-page/23
from any link, for example from mysite.com/node/add/message-board/23 or mysite.com/message-board-page/23

Currently I am doing like this, but it just works for any link that has $arg = 3

$arg = arg(3);
  ....
  href="/user/logout?destination=message-board-page/'.$arg.'"

Any help would be appreciated!


texts: Entity Reference view field - results of the view don't display

texts:
I am using Group module and I have a view displaying the group members.

In a content type, I have a field where I want the members to appear in a select list so I can select one when creating the node.

Example:

**Name of the company**

list: member 1, member 2, member 3 etc

For that I used the Entity Reference module and added a field. In the field I chose Group members and selected the view that displays all members.
But when I am about to add a node, the field displays only two options, and I belive it's the two last created members.
If I go to www.mysite.com/name-of-the-view I can see: member 1, member 2, member 3, member 4
If I select the field with the exact same view I can only see member 3, member 4.

I don't know how to solve this. The view looks just fine...

Can anyone please help? Thanks

This is the view:

This is how it looks like in the page:

This is the field (as you can see with only two members):


texts: How to get a list of all block placed by context before running hook_block

texts:
I'm building a module that manages ad units in the form of blocks that all need to be aware of each other. Similar to this fellow

I need a simple hook or function to get a listing of every block in all the contexts that will be used on the page before I render my blocks, so I can be sure to know the entire list of ad units on the page.

I've tried this

function gpads_sister_positions() {
    $cinstance = context_get_plugin('reaction', 'block');
    global $theme;

    $all_regions = system_region_list($theme);

    $newblocks = array();

    foreach (array_keys($all_regions) as $region) {
        $n  = $cinstance->block_list($region);
     //   dsm($n,"$region");
        $newblocks = $newblocks + $n;
    }
   // dsm($newblocks,"newblocks");
  return $newblocks;

}

I then call this from inside the hook_block in the view op section, like so,

function gpads_block($op = 'list', $delta = 0, $edit = array()) {
      switch ($op) {

        // generate a block for each ad position with 'Provide Block' checked
        case 'list':
            ...
          return $blocks;

        case 'view':
        gpads_sister_positions();
        ...

THE PROBLEM, is that the function $cinstance->block_list returns different value depending upon the loop of the hook_blocks view. It's as if the block_list function need hook_block to be finished rendering the view stage of all block before it can return an accurate list.

To me this seems crazy, so I am probably just doing something wrong.


texts: Drush does not download modules correctly

texts:
Drush says it downloads a module successfully but instead of putting it in sites/all/modules it puts it in the current directory:
$ drush dl module_filter
Project module_filter (7.x-2.0-alpha2) downloaded to                 [success]
/drupal/module_filter.
The folder doesn't exist, but if you run the command again the following happens:
$ drush dl module_filter
Install location drupal/module_filter already exists. Do you want to overwrite it? (y/n):

drush version 7.x


texts: Autocomplete field search start character limitation?

texts:
How can I limit the number of characters on when the search starts send a request to the server?

What happens if I do for example always call my own API (in the sense of using the autocomplete_path attribute)? Is the minimum still 3 characters?


texts: Drupal 7: Duplicated and Extended values on hook_preprocess by Drupal

texts:
I'm trying to pass variables from my module to a template. Everything is working fine, but the variables passed to the view appear to be modificated.

Callback to generate and fill the view:

 function mycallback() {
    //(...)
      //var_dump($members);
      return theme('team_members', $members);
    }

Contents of $members:

array
  0 =>
    object(stdClass)[55]
      public 'mid' => string '1' (length=1)
      public 'name' => string 'LLUIS' (length=5)
  1 =>
    object(stdClass)[18]
      public 'mid' => string '2' (length=1)
      public 'name' => string 'OSCAR' (length=5)

This is the hook:

function global_preprocess_team_members(&$variables) {
  //var_dump($variables);
  $variables['members'] = $variables;
}

The content of $members is the following one:

array
  0 =>
    object(stdClass)[55]
      public 'mid' => string '1' (length=1)
      public 'name' => string 'LLUIS' (length=5)
  1 =>
    object(stdClass)[18]
      public 'mid' => string '2' (length=1)
      public 'name' => string 'OSCAR' (length=5)
  'content' => null
  'theme_hook_suggestions' =>
    array
      empty

Somehow, content, theme_hook_suggestions has been added to the array, but there is more.

Finally, when I print the results on the template file (tpl.php) via var_dump() again:

array
  0 =>
    object(stdClass)[55]
      public 'mid' => string '1' (length=1)
      public 'name' => string 'LLUIS' (length=5)
  1 =>
    object(stdClass)[18]
      public 'mid' => string '2' (length=1)
      public 'name' => string 'OSCAR' (length=5)
  'content' => null
  'theme_hook_suggestions' =>
    array
      empty
  'members' =>
    array
      0 =>
        object(stdClass)[55]
          public 'mid' => string '1' (length=1)
          public 'name' => string 'LLUIS' (length=5)
      1 =>
        object(stdClass)[18]
          public 'mid' => string '2' (length=1)
          public 'name' => string 'OSCAR' (length=5)
      'content' => null
      'theme_hook_suggestions' =>
        array
          empty
      'members' =>
        &array
  'zebra' => string 'odd' (length=3)
  'id' => int 1
  'directory' => string 'sites/all/themes/global' (length=23)
  'classes_array' =>
    array
      0 => string 'team-members' (length=12)
  'attributes_array' =>
    array
      empty
  'title_attributes_array' =>
    array
      empty
  'content_attributes_array' =>
    array
      empty
  'title_prefix' =>
    array
      empty
  'title_suffix' =>
    array
      empty
  'user' =>
    object(stdClass)[9]
      (...)
  'db_is_active' => boolean true
  'is_admin' => boolean true
  'logged_in' => boolean true
  'is_front' => boolean false

I know Drupal adds some variables here (e.g. user session), but as you can see, my array has been added twice. One in the variables root, and another one inside the members variables (with the extra fields I do not want).

What am I doing wrong?

I thing the ideal situation is having the members variable inside the variables without the extra content (only once).

Do you have any idea?


texts: Unique field value for all nodes and content types

texts:
I have list integer field in 3 content types and each have same possible values (from 1 to 6) and I need to disable user to choose the same number for two nodes, so each node with this field filled in need to be unique.

I found Unique field module but it is not working for me, because I have field in each content type and I need to look at all nodes from all content types and this module is on content type base.

Basic example of what I need:

Field field_1 from content type type_1 have value 5, so field_2 from content type type_2 and field_3 from content type type_3 can't have value 5.

Any idea how to achieve this?


texts:
I am using Drupal 7.9.
I need to display main menu with sub-menu.

print theme('links__system_main_menu', array(
'links' => $main_menu,
'attributes' => array(
'id' => '',
'class' => array('menu'),),
'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),)
);

That is the code I have used, but it does not show sub-menu items.

Then i have also tried following code :

if ($main_menu){
  $pid = variable_get('menu_main_links_source', 'main-menu');
  $tree = menu_tree($pid);
  $tree = str_replace(' class="menu"', '', $tree);
  $main_menu = drupal_render($tree);
  }
else {
  $main_menu = FALSE;
}
if ($main_menu): print $main_menu;
endif;

Even it does not display sub-menu.

Does anybody know a solution?


texts:
I have a content type called 'Documents' which has 2 fields: title and file.
There can be attached multiple files the file field.

But how can I show the upload date for every single file?
I have tried using Views, but could only get the upload date for the first file, not the rest of the files.

How can I do this?


texts:
In a webshop I’ve build I want to send  individual e-mails to owners of a prodruct in the shop after a product is sold. To do this I got this as a solution: Send mail to product owner with Rules

But with this I’m only able to send the product owner an e-mail about the product. I am not able to add a shipping/billing address or mailadres form the customer profile to it.

When I try to add the customer profile as a parameter to the component the rules breaks and doesn't work anymore.

This is an export of my component:

{ "rules_perform_an_action_on_a_selected_line_item" : {
    "LABEL" : "Perform an action on a selected line item",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "mimemail" ],
    "USES VARIABLES" : {
      "selected_line_item" : { "label" : "Selected Line Item", "type" : "commerce_line_item" },
      "commerce_order" : { "label" : "Commerce Order", "type" : "commerce_order" },
      "commerce_customer" : { "label" : "Commerce Customer", "type" : "commerce_customer_profile" }
    },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "selected-line-item" ], "field" : "commerce_product" } }
    ],
    "DO" : [
      { "entity_fetch" : {
          "USING" : {
            "type" : "commerce_product",
            "id" : [ "selected-line-item:commerce-product:product-id" ]
          },
          "PROVIDE" : { "entity_fetched" : { "product_fetched" : "Fetched Product" } }
        }
      },
      { "entity_fetch" : {
          "USING" : { "type" : "commerce_customer_profile", "id" : [ "commerce-order:uid" ] },
          "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched user" } }
        }
      },
      { "drupal_message" : { "message" : "Product Mail = [product-fetched:field-e-mailadres-product]" } },
      { "mimemail" : {
          "key" : "[commerce-order:order-id]",
          "to" : "[product-fetched:field-e-mailadres-product]",
          "subject" : "Product order",
          "body" : "OUTPUT PRODUCT INFORMATION AND USER INFORMATION HERE",
          "language" : [ "" ]
        }
      }
    ]
  }
}

This is the export of my rule to loop trough the line-items:

{ "rules_send_mail_to_product_owner" : {
    "LABEL" : "Send mail to product owner",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "Custom" ],
    "REQUIRES" : [ "rules", "entity" ],
    "ON" : { "commerce_order_presave" : [] },
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "commerce-order:commerce-line-items" ] },
          "ITEM" : { "line_items" : "Commerce Line Items" },
          "DO" : [
            { "component_rules_perform_an_action_on_a_selected_line_item" : { "selected_line_item" : [ "line-items" ] } }
          ]
        }
      }
    ]
  }
}

I set the rules action to order presave as this is the easiest way testing the rule, in the end it should run on when payment is first payed in full.

The rule isn't running because of my fault in the parameter settings the parameter commerce_customer is giving problems, I get an error that says: "Missing configuration for parameter commerce_customer".

How can I get to this information in my component?


texts: Ignore UUIDs when comparing the difference between configuration exports

texts:
When building Features, i find it useful to keep a 'backup' of the full configuration and commit it to version control.

If something breaks when i package a feature after i test how it works by doing a full re-install of the profile that brings together the feature modules, i can restore things i missed from the configuration export.

Unfortunately, every site install produces different UUIDs in every configuration file, so i cannot use a diff to determine if there are missing or unexpected changes in the site-install version of the configuration i packaged up.  Drush does not have an export option to strip UUIDs on export.

In the past we used a script to delete all the UUID lines, but not being built into Drush, it was Python or Bash i think, it was awkward to use.  But if i find it i'll post it.

How can i get a clean diff of changes that filters out the noise of the UUID changes?


texts: Is there an easier way to print taxonomies in the tpl? I get this working code, but it should be a "shorter" way!

texts:
After a painful day and a half I get this code, that prints out in my node.tpl.php the taxonomy terms associated to that particular node that the user is viewing.

It works just fine. As it is quite long I´ll just put the whole thing inside a module and into a variable, to just print that.

The thing is that it should get an easier, better way to do this!
Any ideas?

<?php
$vid = 11; //vocabulary id
$nid = $node->nid; //it looks for the current loaded node
$query = "SELECT tid, name
FROM (
SELECT td.tid AS tid, name
FROM taxonomy_term_data AS td
JOIN taxonomy_index AS tn
  ON td.tid = tn.tid
JOIN node AS n
  ON n.nid = tn.nid
WHERE td.vid = ". $vid ."
  AND n.status = 1
  AND n.nid = ".$nid."
GROUP BY td.tid
) AS t
ORDER BY name ASC";
$result = db_query($query);
foreach($result as $term) {
      echo l($term->name, "taxonomy/term/$term->tid") . ', ';
}
 ?>

UPDATE:

This is devel output:
(I´ve used (dpm($node);) because it let me print the result here without losing the indentation)

(object) array(
  'vid' => '5178',
  'uid' => '1',
  'title' => 'PROYECTO',
  'log' => '',
  'status' => '1',
  'comment' => '2',
  'promote' => '0',
  'sticky' => '0',
  'nid' => '155',
  'type' => 'jornadas',
  'language' => 'und',
  'created' => '1095048000',
  'changed' => '1360589684',
  'tnid' => '0',
  'translate' => '0',
  'revision_timestamp' => '1360589684',
  'revision_uid' => '1',
  'taxonomy_vocabulary_4' => array(),
  'taxonomy_vocabulary_6' => array(
    'und' => array(
      array(
        'tid' => '33',
        'taxonomy_term' => (object) array(
            'tid' => '33',
            'vid' => '6',
            'name' => 'Jornadas Gratuitas',
            'description' => '',
            'format' => NULL,
            'weight' => '0',
            'vocabulary_machine_name' => 'vocabulary_6',
          ),
      ),
    ),
  ),
  'taxonomy_vocabulary_7' => array(
    'und' => array(
      array(
        'tid' => '40',
        'taxonomy_term' => (object) array(
            'tid' => '40',
            'vid' => '7',
            'name' => 'Para PH',
            'description' => '',
            'format' => NULL,
            'weight' => '-10',
            'vocabulary_machine_name' => 'vocabulary_7',
          ),
      ),
    ),
  ),
  'taxonomy_vocabulary_11' => array(
    'und' => array(
      array(
        'tid' => '262',
        'taxonomy_term' => (object) array(
            'tid' => '262',
            'vid' => '11',
            'name' => 'colegios',
            'description' => '',
            'format' => NULL,
            'weight' => '0',
            'vocabulary_machine_name' => 'vocabulary_11',
          ),
      ),
      array(
        'tid' => '543',
        'taxonomy_term' => (object) array(
            'tid' => '543',
            'vid' => '11',
            'name' => 'derecho',
            'description' => '',
            'format' => NULL,
            'weight' => '0',
            'vocabulary_machine_name' => 'vocabulary_11',
          ),
      ),
    ),
  ),
  'body' => array(
    'und' => array(
      array(
        'value' => "


texts:
I have attempted to set up a Drupal 7 multi site set-up. I followed the instructions online and have one site (site1) that is setup like a regular single install Drupal site and a second site (site2) set up in the sites/sites2 directory. The sites use separate databases.

The issue I am having is that while site1 displays and operates normally, site2 only displays a white screen. When I executed the install.php script for site2, everything seemed to go normally until I actually try to view the site. Any ideas as to what the issue could be? I am sure that settings.php file in both installations is set up correctly so I am a bit lost.

Thanks.


texts: Get site name config value in page.html.twig template

texts: Is there a way to get the site name config value as a variable in the page.html.twig template? I am only able to get null values when I try to get the value in the preprocess function.


texts: How to use the gmap module withouth a API key?

texts:
I use gmap module to show maps in a website. This module require an API key from google maps. But today I found this page http://code.google.com/intl/es-ES/apis/maps/signup.html when I try to generate a new API key which says:

  The API keys generated by this page are no longer available.

But the gmap module still require it:


texts: How do I create a link in the node template?

texts:
I have a news content type, and the node--news.html.twig template.

I have some fields, but I can not create links to node for text-field from teaser-view. How can I achieve this?


texts: #markup is replacing colon in <gcse:search... tag with space

texts:
I have the following code:

 return array(
      '#type' => 'markup',
      '#markup' => '<gcse:search queryParameterName="query" resultsUrl="'
        . Url::fromRoute('cn.search', [], ['absolute' => TRUE])->toString()
        . '"></gcse:search>',
      '#allowed_tags' => ['gcse', 'gcse:search'],
    );

but the output is:

  <gcse search queryparametername="query" resultsurl="http://d8.constitutionnet.org/search2"></gcse>

How do I prevent the colon being converted to a space?


texts:
I have create new view showing all content referenced by given tag using contextual filter (field_tag: Content) Content: ID zawartości. Now I struggle how to overwrite the view page title with id of tag instead of node id provided as argument of contextual title.

In the contextual filters menu I have only following tokens avaliable:

while I am looking for the token allowing me to use "tag title" instead of "tag id" in the view page title.

The general idea is to have a page listing all content which is referenced by a tag given as a url argument.

I have read answers for similar questions here, but can't really find working solution.


texts: output raw field value with field_view_field in node template

texts: I'm trying to output just the raw value of a field in my node template. When I use 'field_view_field' it puts a ton of css classes around the value which breaks my styles. I just want the value. There must be a way to do this? Is there an option in the field_view_field array I can just call to turn off all the junk?


texts:
I am using the role reference module (https://www.drupal.org/project/rolereference) to allow me to add roles to a content type.

For some context, in my case we are managing policies.  The policy content type will have fields such as "Owner" and "Sponsor" that will reference roles using the module above.

My issue comes when trying to put together views.  I am able to access the role reference field through views without issue, but its sorting is based role id (rid) instead of the role name.

I am attempting to sort by role name, and am unable to create a relationship as Role is not available.

What is the best way to do this?  At the moment it appears that writing a custom module that invokes hook_views_query_alter() to alter the query before it runs might be the best solution.

I'm wondering if anyone has had any success exposing roles as a relationship within views?

Thanks in advance.


texts:
I have a strange issue with my drupal website. I created a image field to let users upload their own user galleries (like favorite images), this is not the profile image. The field works fine, users can upload their photos without limits, i can show it on each user profile (ex, if uid = 10 upload 3 photos, that 3 photos will appear on user profile with uid = 10, not on all profiles).

Now the issue is, in the next day (after the user upload the user photos), the photos disappear, i checked the file_managed table, and they no longer exist, but the entries on field_data_field_user_gallery exists. I tried to reproduce the error and this is what i do:

I log as user, upload some photos to my profile;
I visit my user profile page and everything work;
I change my computer date to next day;
I check table file_managed and files still exists;
I visit my user profile again, and no images;
I check again file_managed and the previous entries disappear;

Anyone has any suggestion for fixing this? I already tried to create a new image field, tried to put in different directory, but always end with the same :/ .

Thanks everyone for your help.

UPDATE

I did some tests with @arpitr and found new data. The error (image deleted from file_managed) only happens if i am logged in as VIP user (a role that i have on my site), so if i am logged and admin or "normal user" or even without login, the behaviour is correct, i can visit the (vip) user profile without any problems. Only VIP users can add and edit user gallery.

I temporarily found a solution using file_lock module, but i want to know and fix if possible why is this happening only with vip user role logged in.

Any ideas?

Thanks a lot.


texts: Is there an official/recommended way to organize CSS files for a responsive theme?

texts:
While creating a responsive theme (eg. a bootstrap based sub-theme) is there an official/recommended way to organize CSS files for different media queries? In general I put everything into one CSS file.

1. All In One

mytheme.info:

...
stylesheets[all][] = css/style.css
...

style.css:

body { ... }

p { ... }

...

@media (max-width: 767px) {
...
}

@media (min-width: 1024px) {
...
}

2. Separated CSS Files

mytheme.info:

stylesheets[all][] = css/style.css
stylesheets[all][] = css/480.css
stylesheets[all][] = css/720.css
stylesheets[all][] = css/960.css

style.css, 480.css, 720.css ...

3. Separate CSS Files for Each Media Query Defined in .info File

mytheme.info:

stylesheets[all][] = css/style.css
stylesheets[all and (min-width: 480px)][] = css/480.css
stylesheets[all and (min-width: 720px)][] = css/720.css
stylesheets[all and (min-width: 960px)][] = css/960.css

style.css, 480.css, 720.css ...

4. Other?

I wonder what is the recommended way for this or it doesn't matter (structural, performance wise etc).


texts: Remove Parent Theme Settings From Child Theme

texts:
I'm in the middle of creating a custom theme using the Bootstrap theme as it's parent. As you may, or may not be aware, the Bootstrap theme comes with lots of useful theme settings. These are great, but as this custom theme will be used for a client, most of these settings could be dangerous for them to be able to change.

I'd like to remove all of these theme settings, so only the ones I add in my custom theme will appear.

I know these theme settings would still be available to change in the Bootstrap theme, but that's not a problem.

Thanks


texts:
I have created a form that I will embed in my page with a custom module. How can I wrap this form with a div that has a specific class?

I need to add it to the build which is made with the following code.

$build = array(
          'form' => $form,
          '#type' => 'markup',
          '#markup' => $html,
          '#attached' => array(

             'library' => array('pup_viewfiles/sortfiles_libraries'),
            ),
        );


texts: Why are URL encoded values in $_GET variables broken?

texts:
I'm working with a payment gateway that returns payment feedback in the URL. One of the variables has a special character in it:

PM=Sofort+%DCberweisung

The %DC is Ü. However, it's coming through instead as �—and in case that doesn't display properly here, it's a black triangle with a question mark inside it. I confirmed this by replacing my menu callback with a simple print and die:

print($_GET['PM']); die();

The output is just (again: I'm not sure how that broken character might appear here on StackExchange):

Sofort �berweisung (DE)

I have confirmed that if I replace the %DC in the URL with Ü, it prints fine, so it's not a problem with that character: something is going wrong, somewhere, when the server tries to decode the URL-encoded value.

Does Drupal do any kind of processing on $_GET variables during bootstrapping? Could this be an Apache configuration issue?

Update: This is definitely something in Drupal. I moved my print-then-die to the very beginning of index.php and it prints the correct value. This tells me that it's not an Apache problem. Then, on a clean D6 install with no contrib modules, I added a small module that just adds a single menu callback to do that same print-then-die, and I got the invalid character there.


texts: basic difference between Date, Date(ISO format), Date(Unix timestamp) to create a field

texts:
I have created a field as field type Date(Unix timestamp).

When i edit a content with some input value in the above created field it shows an error like below:-

PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'field_reprisal_date_value' at row 1: INSERT INTO {field_data_field_reprisal_date} (entity_type, entity_id, revision_id, bundle, delta, language, field_reprisal_date_value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 258985 [:db_insert_placeholder_2] => 245170 [:db_insert_placeholder_3] => embedded_video [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 2015-03-02 ) in field_sql_storage_field_storage_write() (line 494 of /www/d7yourtango/modules/field/modules/field_sql_storage/field_sql_storage.module).

But after deleting above field again i create another field as field type Date and i process same, it work.

So my question is why it happening so for 1st case?

And what are basic difference between field types of Date, Date(ISO format), Date(Unix timestamp) to create a field.


texts: Set author to the node automatically whenever the new user registered and also automatically authenticate the user

texts:
I have a Drupal site with content type people. In that content type I have a field that contains an email id.

What I want to do is, whenever the new user is registered, I want to compare the user's email with the email field of all the nodes with people as the content type. If these 2 fields match, then set the user as the author of that node.

I don't know how to execute this process.

Can anyone give me a solution?


texts: How do I modify the email maximum length to 320 characters?

texts:
I want to overwrite the maximum charcater limit to 320. It is defined in /core/lib/Drupal/Core/Render/Element/Email.php
Can anybody tell me how to overwrite it?


texts: Which are the differences between hook_node_view_alter and hook_preprocess_node?

texts:
I have to remove some elements from a node before show it, but I can't understand where it's better to put the code.
Mainly I can't understand the differences between hook_node_view_alter and hook_preprocess_node. It seems they do the same thing as they receive a render array as parameter.

I think the best option should be to use the hook_node_view but it isn't the right way to do this because in this hook only $node->content is editable.


texts: Site Time Zone = field time zone but != database time zone

texts:
My site time zone setting under Admin>config>regional... is set to Chicago time.

My field date setting is set to use my site time zone.

My user account is set to Chicago, but when I look at the database, it is recording my time as a totally different time zone.

What am I missing? I really need to resolve an issue with Drupal resource-conflict module and the fact that my all-day events don't conflict with my hourly events. There is a topic here - https://www.drupal.org/node/2270533, but I can't seem to get my dates straitened out to even try it. Anyone offer some advice?


texts: Get field_collection values in field template

texts:
I have installed field_collection and have a collection called field_contact,
each entry of which has a field called field_contact_url

I'm trying to customise the display of that field by overriding the view template, using the file views-view-field--field-contact.tpl.php

The template is being used, if I put a simple print 'hello' I can see the hello come up, but I cannot figure out how to access the field_collection properties.
I've gone through every answer and example I can find on google, but all of them seem to rely on a variable that is not there.

$content is not present
$node is not present
$field is present, but $field->field->id is empty
$items is not present

I tried using this example, but the $rows is not showing up (perhaps because I put the functions in the wrong file... I put them both in the template.php file.

I have spent 6 hours trawling through Drupal docs, would really appreciate if someone could help me figure out what variables I need or where I need to put the template file so the right variables become available.


texts: How can I load a javascript file into a Drupal 7 page using the Code per Node module?

texts:
What is the syntax for including Javascript from a remote location into a Drupal 7 page using the Code per node module?

I have seen this code drupal_add_js('path/to/somescript.js') at Managing JavaScript in Drupal 7 | Drupal.org, but it seems that is not for use on Drupal 7.

What would be the Drupal 7 equivalent?


texts: Speed up login after changing user name datastore type to VARBINARY from VARCHAR

texts:
We have a project underway that requires the import of ~6 million users into Drupal (Core 7x) that have many (150K+) case-insensitive duplicate usernames. Importing these users with existing case and allowing them to log in thereafter (case-sensitive) has been deemed mission-critical by stakeholders, and it's a must-include feature. To facilitate this, I've changed the data type on the users table to VARBINARY from VARCHAR, which allows duplicate usernames with different case, and imported all users successfully.
After making this change, the problem now is that logging in takes a very long time (9-14 seconds) under no server load. Are there ways to speed this up and/or make any change necessary that can significantly improve the performance?
Index on the user table does include name. Picture attached.


texts: How to add a role to specific product type customer?

texts:
I'm trying to add a user role (darshan) to customer buying product from a specific product type (darshan_session), using an EventSubscriber in a custom module.

For now, I'm stuck with the following code, where I need still to check the product type and to load the user from the ID.

namespace Drupal\commerce_darshan\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\state_machine\Event\WorkflowTransitionEvent;
use Drupal\user\UserAuthInterface;
use Drupal\user\UserInterface;

class CommerceDarshanEventSubscriber implements EventSubscriberInterface {

  public static function getSubscribedEvents() {
    $events = ['commerce_order.place.post_transition' => 'onOrderPlace'];
    return $events;
  }

  public function onOrderPlace(WorkflowTransitionEvent $event) {
    $event->getEntity()->getCustomerId();

    $user->addRole('darshan');
  }
}

As this is my first custom module on D8, any help would be welcome.


texts: How to add Wishlist/Add to Cart in all products shown in front page in drupal 7?

texts: I am work on commerce_kickstart site. I was created 3 views in my front-page. In each view 3 products are there. I want to add Wishlist/AddToCart below in the list of every product. How can i do this. Please Help. Thanks


texts: Is it Possible to set a default context?

texts: I want to specify a default context , so if there is no context applied It should be the one to apply


texts: How to determine if the current Drupal page is a contact page?

texts:
With Drupal 8, in THEMENAME.theme I can generate a class based on the current node ID which will be inserted in the body tag :

In the THEMENAME_preprocess_html() function, i use :

$node = \Drupal::routeMatch()->getParameter('node');
  if($node) {
    $variables['attributes']['class'][] = 'node-' . $node->id();
  }

But how can i determine if we are on the contact page since it is not a node ?


texts:
I want to know the Request New Password form id. (www.example.com/user/password).

I found out that the register form is "user_register_form" and tried same for password (user_password_form / user_pass_form / user_pass_reset) but nothing worked.

Hope you can help me! Thanks a lot!

Edit: If you could tell me the account form id in the same breathe, the answer would be simply awesome.


texts:
I have a custom module that uses AJAX. Everything works fine the way it is. I'm just wondering if it's the proper way to do it in Drupal. I'm new to Drupal 8 and 9 programming
This is a line from my code
$link ='Test AJAX';

Is this ok to do or should I be building my link? If so, why and how?
EDIT
I currently build non-ajax links like
  $url = Url::fromRoute('entity.node.canonical', array('node' => $record->nid));
  $title_link = Link::fromTextAndUrl($record->title, $url);
  $title_link =$title_link->toRenderable();
  $title_link=render($title_link);


texts: How do I access paragraphs with the JSON API?

texts:
With the JSON API module, I am trying to access paragraphs.  In the JSON object it does not allow me to access the nested paragraphs.

How would I go about accessing the paragraphs with the JSON API?

*****Update with Solution*****

In the api call you need to have the correct URL format:  /jsonapi/{entity_type_id}/{bundle_id}[/{entity_id}]?_format=api_json.  The key here is to add this at the end of your the URL for the api call:  ?include={name of paragraph}.  For example:    /jsonapi/node/page?_format=api_json&include=field_testing_json_api
Once you have the correct API call, you need to go to the Drupal admin dashboard and go to people/permissions and under the Paragraphs Type Permissions section you need to grant access to view content to the specific paragraph you want the user to access.


texts: How to pass node ID argument to Drupal 7 div auto update ajax script

texts:
EDIT: There seems to be a ready-to-use http://drupal.org/project/block_refresh module available as @albertski indicated, so no need to struggle to develop a new module.

I've implemented the code on https://stackoverflow.com/questions/8144436/refreshing-a-div-in-drupal to get a Drupal 7 node page division auto-updated. Here is the code outputting simple time() function:

Hook menu:

$items['autoupdate'] = array(
'title' => 'Resize',
'page callback' => 'block_update',
'access callback' => TRUE,
'type' => MENU_LOCAL_TASK,
  );

Function itself:

function block_update(){
$html = time();
print drupal_json_encode(array('html' => $html)); exit(); }

Javascript:

    function autoupdate() {
  //alert('autoupdate is running');
  jQuery.ajax(
  {
    type: "POST",
    url: "/autoupdate",
    cache: false,
    success: function(data) {
      var result = JSON.parse(data);
      jQuery("div.autorefresh").fadeIn("slow").html(result['html']);
    }
  });
  //alert('autoupdate is complete');
}
setInterval("autoupdate()", 2500);

However, instead of time() I would like to use node variables and having troubles to make the module to see $node. Even if I put my div on a node page and call menu_get_object() the javascript sees only the content /autoupdate page:

function block_update(){
  $html = arg(0);
  print drupal_json_encode(array('html' => $html));
  exit();
}

shows: autoupdate

I tried to change the path in both hook menu and javascript from autouptade to node/%node/update, but unfortunately javascript doesn't want to recognize %node as argument. I am afraid it recognizes only static URLs. But then how is it possible to pass node ID to javascript?


texts:
I create a template called page--user--edit.tpl.php

Into that file, I want to display some inputs for editing like username and password only, not the default edit form.

I don't know the code to put into this file for displaying only these input.

Thanks for your help !


texts:
I've seen a few other issues where people were causing this by calling node_submit followed by node_save, but I'm not - any ideas why this is creating a duplicate of every piece of content?

$art = node_load($node->nid);
$field_language = field_language('node', $art, 'field_intro');
$art->field['field_intro'][$field_language][0]['value'] = $record->intro;
node_submit($art);
print $art->title . ' saved <br />';

I've tried both node_save and node_submit, both with the same results

EDIT: sorry guys, it was a conflict with a bit of code from another custom module - nothing to see here!


texts: Emails sent by actions not using html email formatting

texts: I have the HTML email module and it is working for most site emails, however those that are called by actions/triggers don't use the template. How I can I force this behaviour?


texts: What is the latest drush version and how do I install it?

texts:
I have drush installed using what in principle is the latest stable build as per the instructions. When I run drush version then i get the reply 8.0.3, however on my workstation with Dev Desktop installed it tells me it's 8.0.5.

Running drush dl drush proposes a version 8.x-6.x-dev dated 30 September 2013 which seems very old, and I can see no sign of a v8.1

Looking at the documentation I have not been able to see any other indications of how to go about this, and I am confused. Can anyone tell me whether the drush dl drush is still valid and what the current latest version actually is?


texts: Search API returning no results even though nodes have been indexed

texts:
I have a very simple set up as described below.

modules:
Search API 7.x 1-1
Search Pages 7.x - 1.2
Database Search
Devel Generate

I’ve set up a database server and an index for indexing nodes. The nodes were created using the Devel Generate module. The nodes have been indexed as shown on the Search API ->View->Index Status. On the Nodes->Index->Fields tab I’ve several options like Node ID, Content Type, Title, Status, etc. In Structure->Blocks I’ve added the Search Index to the page in the sidebar.
I also set permissions so anonymous users can administer  search.

But when administering a search nothing is returned.  For test purposes, when entering in the same search term (‘Amet’) in the default search, results are being returned.

How do I troubleshoot this? What is the problem here? Anyone help would be appreciated.


texts: What hook is most appropriate for code that should run as early as possible in bootstrapping but only on certain paths?

texts:
I am writing a module that should run code as early as possible because it's a conditional redirect to another page, so the first page doesn't need to finish loading.

I only want to run it on /foo/*.

Is there a hook that can be bound to a particular path, like hook_form_alter() can be with form IDs? Or should I just use hook_init()?


texts: How can I filter child terms in an exposed filter by parent term from contextual filter?

texts:
I have a vocabulary of Districts with nested taxonomy terms like below.

I have a view of taxonomy terms in Drupal 8 which has an exposed filter of all terms with parent and child. What I want is that when I add a contextual filter of term parent the exposed filter should only show child terms matching the parent term in the contextual filter.

For example, if the URL contains Deoghar, then the exposed filter (like below filter) should only show the term Karon as option.


texts: Usernames in git commit messages on Drupal.org

texts:
I recently changed my username on drupal.org, and as a result is now different from my git username.

When you attribute a patch someone else using the commit author, you use the anonymous email address, which is based off of the git username (which also shows up in that user's profile page.

When you can commit directly to a project, there is a standard format for commit messages:

  Issue #[issue number] by [comma-separated usernames]: [Short summary of the change].

Are these supposed to be the git username or the drupal.org username?


texts:
I want to have the following exposed filtering:

Older events
Events in the next 7 days
Events in the next 30 day

My date is already set as a exposed filter with the relative date "now". But that works only for one of the options, the other filters need now + 7 etc. But I cannot enter different relative dates (see screen). Is there a way to combine those three filters?


texts: How do I pre-fill a image field in a form with javascript

texts:
I've got a form which I want to fill with javascript on a button click. This button click retrieves the data via a javascript call.
All regular fields are no issue, I just cant seem to be able to pre-fill the image (file) field. I've tried replacing the element with a rendered html block, which shows the image field but loses the functionality.
Any pointers/tips/solutions are very much appreciated. If you want to see some code, please let me know and I'll post it. I did not know what (if any) code to post, so to prevent a code-overflow I opted to post nothing.
Thanks in advance.


texts: Workbench Moderation and Custom Field Issue

texts:
I have another "interesting" problem using Workbench Moderation. I'm using Workbench for workflow, along with Workbench Access, Workbench Moderation (7.x-1.3) and Workbench Moderation Notes on a new Drupal 7 site.

I have created a custom Approvers field on my content type that editors will use to select which approver should receive the notification email. This is a list field where the approver name is displayed for selection (the label) and the associated value (key) is the email address of the approver. The latter is to be used in a rule to send the email to the correct address. I have written some PHP to extract the value from the selected item in this Approvers list field:

<?php

$node_id = arg(1);
$node = node_load($node_id);
$fieldname='field_approvers';
 $items = field_get_items('node', $node, $fieldname);
if($items)
{
$key = $items[0]['value'];
echo "key = ". $key;
}
else
{
echo $node_id;
}
?>

Note that this is inserted in a block for testing purposes and I am not very experienced in PHP (or Drupal for that matter!).

While testing, I have discovered that before publishing the node, all works well and I can extract the correct email address. However, similar to my issue yesterday (Workbench Moderation - Issues with New Drafts of Published Nodes), once a node is published and set back to draft, things stop working properly. The published value of the list field is always returned, even when the list field itself shows the correct new approver. So, if I set back to draft and change the approver in the list field, the PHP code will always return the value from the published version of the node. I have debugged the node and checked the database and the web and I can't figure out how to get the Approvers list field value from the current revision.


texts:
I am trying to append a twig template on every page .
In drupal 7, we basically append it using hook_page_alter

      function hook_page_alter(&$page) {
      $page['page_bottom']['devel']= array(
            '#type' => 'markup',
            '#markup' => '
' . theme('TEST') . '
', );  //add test template on every page at bottom position
 }

but in drupal 8 there is no hook_page_alter i think.

How to do this??


texts: Creating a form with GET bypases the validation and submit

texts:
I am creating a simple form, when sumits, shows result from an external API.
But URL remain the same, so you cant get a url if your search result and send it to someone.

But when I use get

$form['method'] = 'get';

It shows a construted url..

mysite.com/search?cat=2$coutry=3

But it donot fetch the result, cause it is bypassing the submit and validation functions.
Any help?


texts: Is it possible to use another menu as a submenu of a menu?

texts:
Is there a setting or a module, this would facilitate re-use of menus...

For example:

Menu 1
  option A
  option B
  option C
  option D

Menu 2
  option 1
  option 2
  option 3
  option 4

Full Main Menu
  option A (use menu 2 for sub menu options)
    option 1
    option 2
    option 3
    option 4
  option B
  option C
  option D


texts:
Help me please. How can I get the value of the pressed button. Thanks!

$items = [];

foreach ($result as &$value) {
  $items[] = [
    $form['repo'] = [
      '#type' => 'fieldset',
      '#title' => $this
        ->t('FIELD REPO'),
    ],
    $form['repo']['repo_name'] = [
      '#type' => 'item',
      '#title' => $value->name,
    ],
    $form['repo']['user_name'] = [
      '#type' => 'hidden',
      '#title' => $value->name,
      '#value' => $value->name,
    ],
    $form['repo']['submit'] = [
      '#type' => 'submit',
      '#value' => $value->name,
    ],
  ];
}
$form['repositories_arr'] = [
  '#theme' => 'item_list',
  '#items' => $items,
  '#attributes' => ['id' => 'repositories_arr'],
];

return $form;


texts: How to add explanation text/link to selection options in views page

texts:
First my apologies for my probably stupid question, but I can't find an answer on this one:

I'm using Drupal 7 and I have created a page with news articles based on Views. On top of the list of news items there are 2 options to filter that list of items: First a pull-down menu with a list of products the news items could be linked. The other option it to type one or more tags. One can also use a combination of those two.

This is rather straight forward for me, but I'm expecting our users would need some explanation.

How can I add a small piece of text right of the selections options (containing a link with an explanation page) ?

I found this message on this site, but without clear explanation how to build something like this: Is there a module for site explanation messages?


texts: How to update path alias using MySQL command line

texts:
Many words have been renamed in the node using the below code:

update node set title = replace(title,'Apple','Orange')
update node_revisions set title = replace(title,'Apple','Orange');

But now I need to know how to update the path aliases using the MySQL command line; using the Drupal administration interface is very tiring, for thousands nodes.


texts: How to display second level menu on another node page

texts: I created a menu by Menu block module. I added a link 'to /news' in the first level. The second level are news categories (taxonomy items). I want to display the categories (2 level) on node page. How to do that?


texts:
I am interested in limiting the nodes a user can publish.So Node limit module cannot help on this.
Someone suggested using userpoints and rules to achieve this.
How is this possible with these 2 modules?
Any help would be appreciated.
thanks!


texts:
I can't find any solution to reorder some fields on user profil pages (like user/%/edit). At first I see User photo and language options. But in field options I have set another fields to be applied to the first position.

I have no possibility to move some fields to wished position.
Have you any advice, how to do it? Thank you very much. Peter.


texts: How can you reference taxonomy term by another field in Yaml file?

texts:
I created my own Yaml file with fields inside to migrate nodes.

I run into this problem.
If I use the feeds module, I can set (during mappings) that a given field (taxonomy term reference field) can be referenced by any other field from my site. The term name is therefore assigned based on the value in the reference field.

If I use Migrate CSV module, how do I set this in Yaml file?
This is my Yaml:

uuid: bf1e53ae-6a95-48f2-8888-4b928e6e33ea

id: testovacimigrace2
label: My own migration !!!!!!!
migration_group: migration

source:
  plugin: 'csv'
  # Full path to the file.
  path: 'modules/custom/migrace/assets/csv/upload1.csv'
  delimiter: ','
  enclosure: '"'
  header_row_count: 1
  ids:
    - ID

process:
  title: title
  field_email: email
  type:
    plugin: default_value
    default_value: submitlawyer

destination:
  plugin: entity:node

Every term in my taxonomy called "fishes" has its own field with a unique number.
My CSV contains a column called fish that does not contain a term name but its unique number (ad.1)
I need to assign the correct term by using this unique number.


texts: How do you disable Timezone from being edited in a User account? Is there a config setting I can turn off?


texts:
I have a content type including these two fields

and now I want to use those fields in a "Rules" action, but they are not present in the replacement patterns to choose, and they're not present in the Data Selection  mode either.

What have I missed? Would appreciate if someone could point me in the right direction.

My rule export code

{ "rules_fiberbest_llningsemail" : {
"LABEL" : "Fiberbest\u00e4llningsemail",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_insert--fiberbestallning" : { "bundle" : "fiberbestallning" } },
"IF" : [
  { "node_is_of_type" : {
      "node" : [ "node" ],
      "type" : { "value" : { "fiberbestallning" : "fiberbestallning" } }
    }
  }
],
"DO" : [
  { "mail" : {
      "to" : "me@example.com",
      "subject" : "Fiberbest\u00e4llning",
      "message" : "Ny fiberbest\u00e4llning fr\u00e5n hemsidan skapad [node:created]\r\n\r\n[node:url]\r\n[node:field-f-rnamn]\r\n[node:field-efternamn]\r\n[node:field-adresss]\r\n[node:field-postnummer]\r\n[node:field-postadress]\r\n[node:field-fibertyp]",
      "language" : [ "" ]
    }
  }
]


texts: entity_generate migration plugin with multi value fields

texts:
I haven't found any way of using entity_generate with multi value fields in Drupal 8. Does anyone have any experience in how/if we can do this?

This is the relevant part of my current field mapping:

field_operation:
    plugin: entity_generate
    access_check: false
    entity_type: node
    source: operation_name
    value_key: title
    bundle: operation
    ignore_case: true
    values:
      title: operation_name
      body: operation_description

and this is the relevant part of the migration fields definition:

-
  name: operation_name
  label: 'Operation Name'
  selector: $.Service_Description.Operation[*].Name
-
  name: operation_description
  label: 'Operation Description'
  selector: $.Service_Description.Operation[*].Description

If I have three operations in the JSON source file, it migrates three values in the relevant field, but all values are the same.


texts: Alter a date format in a view based on another date

texts:
In Drupal 8, I have a View formatted as a Table displaying a node type with two Date-Time fields. They are Start Date and End Date. Within the View I have them in the same column. I would like to alter how the End Date displays based on the Start Date. In particular, if the End Date is the same day as the Start date, I only want the time component displayed. I have created a Time date format for use elsewhere, that I assume will be referenced for this. In the event that the dates are different days, they need to use the default format.

I assume that one of the view hooks is what I need. But I am unsure of which one and do not know exactly what I would need to alter in the view's code.


texts: Is there a dummy field to provide additional instructions to the users on node add form?

texts: I'm building quite complex node form and I need to provide users with additional instructions how to fill the form. Are there any modules that would allow me to add sort of dummy fields with some HTML that would be displayed when user edits or creates new node? I don't want to save any data for these fields. I would like to be able to provide some HTML that will be displayed among other node form elements. Even plain text would do.


texts: How do I theme my module output (specifically the nodes coming out of EntityFieldQuery)?

texts:
I'm using EntityFieldQuery to get node IDs that match certain criteria in my module. At the end, I am doing: return node_view_multiple($nodes, 'full'); in the page callback function (which itself is called from hook_menu).

If I use node--content-type.tpl.php, I override the display everywhere. Ideally, I would like an array containing Node information that is sent to the tpl file, (like a controller returning display array to a view in CodeIgniter), which I can loop through and create a custom display.

How do I go about this?


texts: How do I create a custom view filter for an existing field?

texts:
I ran into a problem with creating a custom view filter for an existing field for Drupal 8. I mean a filter not for fields like "nid", "title" and so on, but for fields, which were named CCK-fields first.

Could you share with me an understandable example of code, how to create this plugin?

I tried to comprehend some examples in contrib modules, like the geolocation module, but that code was very sophisticated. Also, I haven't found adequate manuals anywhere.


texts: PDOException when saving node with AudioRecorderField

texts:
Occurs on client's computer but not mine. Does not appear to be a user-related problem. Using SoundCloud recorder.

PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid
input syntax for integer: "NULL" LINE 4: WHERE (base.fid IN ('NULL')) ^:
SELECT base.fid AS fid, base.uid AS uid, base.filename AS filename, base.uri
AS uri, base.filemime AS filemime, base.filesize AS filesize, base.status AS
status, base.timestamp AS timestamp FROM {file_managed} base WHERE (base.fid
IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] =>
NULL ) in DrupalDefaultEntityController->load() (line 196
of /Users/Shared/Server/HTTP/chinese/includes/entity.inc).


texts: Views AJAX error when too many results returned per page?

texts:
I have a View that returns a complete list of all my site's users and their data. That being said, I have 1000 users. If my view returns 500/page, I'm able to view it successfully. However, if I want all of my user data displayed on one page (ie. no pager), Views throws me an AJAX error that reads:

  An AJAX error occurred. HTTP result code 500. Status Text: Internal
  Server Error.

Why is this happening? How can I make it so that all data can be displayed on one View page without this error occurring?


texts: What is the best way, programmatically, to iterate through a view's results?

texts:
Given a view, named 'Children' (with two fields: child_node_id and a birth_order_value) what is the best way, programmatically, to iterate through the views results set given a display_id of 'default' and an argument that contains the parent node id?

Previously, I have used the View in a block using code similar to the following:

if ( arg(0) == 'node' && is_numeric(arg(1)) && ! arg(2)) {
   $node = node_load(arg(1));
   $args = array($node->nid);
   $view = views_get_view('Children');
   print $view->preview('default', $args);
}

However, in another block I want to perform some logic based on the values found in the view.  You might be able guess that business logic based on my final requirement: I want the block of code supporting the view ('Children') be called multiple times. As I iterate through the view dataset results, I want to recursively iterate through the children nodes querying for their children.


texts: How to add css using the Preprocess_image function?

texts:
I'm trying to preprocess my image style like this example

<img class="media-object img-rounded img-responsive"  src="http://placehold.it/350x250">

My preprocess_image function looks like so:

function bootstrap_subtheme_preprocess_image(&$variables) {
  if(isset($variables['style_name'])) {
    if($variables['style_name'] == 'logged-in') {
      $variables['attributes']['class'][] = "media-object";
      $variables['attributes']['class'][] = "img-responsive";
      $variables['attributes']['class'][] = "img-rounded";
    }
  }
}

But it is not adding the classes.

Why not?


texts: Moving my drupal from subdomain to domain

texts:
I have a drupal in http://nuevo.drupalsite.com.mx and is working perfect, but when I move drupal to my root folder and run http://drupalsite.com.mx the homepage is work but internal paths is not working, is to say:

drupalsite.com.mx  =>is work!
drupalsite.com.mx/user  =>is NOT work!
drupalsite.com.mx/products  =>is NOT work!
drupalsite.com.mx/service  => is NOT work!

All paths show error 404 and I cant into the user /admin page....
Help me please!


texts: How to create a view of counts of taxonomy reference fields by each user?

texts:
I have a content type that contains a taxonomy term reference field. each user can create unlimited nodes of this content type and select different term at each time. now we want make a view of count of this terms selected by users as a table like this:

is there any plugin to support create these type of tables in views? or we should do it programmatically? I appreciate any help.


texts: changing role wen opening a confirmation link but auto login with logintoboggan

texts:
We are using logintoboggan to login new users after registration. After the registration the users get the role 'unconfirmed user' with limited permissions. The users need to open the confirmation link to get another role 'confirmed user' with more permissions.

Logintoboggan disables the option to send a confirmation link to the user.

How can I send an email with a confirmation link to the new user and how can I switch his role when opening the link?