texts: Is it possible to address a single item of a field collection in pathauto?

texts:
I'm making sort of a slideshow for a customer

The slideshow has a field collection which has itself several fields that contain the actual content of the slides (headline, text, image, alt text, image caption)

And the slideshow is a node which uses several fields: title, teaser texts, teaser title texts, links to other pages etc.

The customer wants the slides to have individual URLs which I want to be created with pathauto module. The token which I use for a normal node (on admin/config/search/path/patterns) is like this [node:title]-[node:nid]. This works ok

But how about the token for a individual slide? If I administer the fields for my field collection (admin/structure/field-collections/field-pages/fields), there is no such default field like URL-alias.

Do I need to use the token hooks to create new tokens? But how? How can I then add them to the URL-alias? I suggest with hook_presave? Could it be done?


texts: Is there a way to get a default e-mail recipient by default when adding a new webform node?

texts:
When I add a new Webform node type, this have no e-mail recipien by default. You can read this message:

  Currently not sending e-mails, add an e-mail recipient below.

Is there a way to get a e-mail recipient value by default when creating a webform node?


texts:
Case: Delete all empty orders for a user when he/she login to the website.

We are using drupal commerce.

Please Help.


texts: how to create the pagination for customized portfolio template

texts:
I will create the portfolio gallery page using custom content types with thumbnail and bigimage  image fields. then i am using the following code for rendering content types

<?php
$content_type = 'websiteportfolio';
$query = new EntityFieldQuery();

$entities = $query->entityCondition('entity_type', 'node')
->entityCondition('bundle', $content_type)
->propertyCondition('status', 1)
->pager(9)
->execute();
$nodes = entity_load('node', array_keys($entities['node']));?>

<?php
  $i = 1;
  foreach($nodes as $val=>$key1)

  {

 ?>

<a href=<?='sites/default/files/'. $key1->field_bigimage['und']['0']['filename']; ?> rel="lightbox[portfolio]"  title="<?= 'Portfolio'.$i ?>"><img src=<?='sites/default/files/websiteportfolio/'. $key1->field_images['und']['0']['filename']; ?> alt="<?= 'Portfolio'.$i ?>" />

 <?php
$i++;
}

 ?>

finally i got the 9  thumbnail images in my page and also light box functionality working well.My issue Only show first 9 images I need pagination for showing the remaining images how  can fix this issue..


texts: Wrong and ignored language to be translated

texts:
My website is by default in French and I need to get an English version.

Prob n°1 : I've got this kind of Exposed filter (exported in a block), everything in it is translated excepted "Tri" (sort) and "Appliquer" (apply) which stay in french.

Here, you can see all modules about languages/i18n (add i18n, i18n_block)

In my exposed filter settings (in FR) :

In the view, translate view > English > traduire > and I wrote this

In Config > Regional > Translate I found what I wrote correctly

Answer n°1 : Why my exposed filter labels can't be translated ?

Answer n°2 : Another thing, it's maybe common but I found this strange, when I write a sentence in t() function, it must be in english and not in my site language else I get

Is it normal to write in english in t() function even if the site language is not ?

Thanks in advance for helps. I'm listening some tricks, advices and good practice about languages.


texts: How to not display redundant information in table Views?

texts:
In a custom module of mine (Drupal 8.2.6), I have two custom entities A and B with a one to many relationship from A to B.
I use Views (table view) to display content of A and B and by default I get this:
Field1 (from A) Field2 (from B)
xxx aaa
yyy bbb
yyy ccc
zzz ddd
I'd like to NOT display yyy the second time.
How can I do that?

[Edit] just an example, instead of what is (by default) on the left, I'd like what is on the right of the picture:


texts: How can I make individual nodes fieldable?

texts:
One of the great things about the Entity and Field APIs is the ability to add fields to any entity (nodes, users, etc.) and subsequently any bundle (e.g. node content types).

But is there a way, using the Field API or the Entity API, to make fieldable nodes? That is, have field instances attach to individual nodes instead of content types/bundles. So node 1 might have a file field and a text field, node 2 might have a number field but no text field, etc.

If there isn't, is there any work being done using other concepts that would achieve the same result? The closest I can think of is Webform, but I'm sure that it's not intended to be a way to create content, and it doesn't take advantage of the Field API for its fields.


texts: How can I trigger a call to a custom module function before the browser unload event?

texts:
I have built a report for an client account that shows payments and charges with totals. I am now adding an export button using the PHPExport module.

As I already built the data to display in the web report, it seems inefficient to build it again if the user wants to export it. So I am thinking of building the arrays ($header and $data) needed for the report at the same time as I build the report page to display in the browser.

In order to then have access to these arrays in my export function, which would be called by a form submit, I will need to store them in the database (is that right?). Then, if the user submits and export request, I retrieve the arrays and pass them to the phpexcel_export() function and Robert's your mother's brother.

When the user then navigates away from the report, I will need to tidy up, by which I mean delete the arrays from the database. Do I use the onBeforeUnload API to achieve this? It seems from the api page to be little used.

Or am I approaching this from the wrong angle? Is there another way to persist the arrays from producing the page to submitting the export request from the page?


texts:
I have a problem with my drupal 7 site. It could be registered to my site but "forgot password" section (link) is not working. What should I do to solve this problem?

In my authentication form there are 2 links: 1) Registration 2) Forgot password? For example when you click "Forgot password?" link, a letter comes to my e-mail. And there is a url in letter which takes you to my drupal site. If you click url (which takes you to my site) you are in the site now but there isn't reset password form


texts: Update the from name in workbench email template

texts:
I'm trying to update the "from" name in my workbench email template. I created a custom module and added the following hook ('hook_mail_alter') but it's still not updating the from name for my email template. Does the below hook look right?

function my_module_mail_alter(&$message) {
  if ($message['id'] == 'needs_review') {
  $message['from'] = 'Full Name <email@address.com>';
  }
 }

https://api.drupal.org/api/drupal/core%21core.api.php/function/hook_mail_alter/8.7.x


texts: Domain Access - restrict content for only authenticated users (and keep domain specific settings)

texts:
I have a site using domain with multiple subdomains.

I want to display some of the particular domains. I can do this with the "Publish to *" field in the domain access options. How do I also restrict access to some content types so that only authenticated users can access these content types and also work with domain access?

I had the module content_access installed to prevent ANONYMOUS USERS from viewing specific content types but this was causing problems with domain as it would write to the node_access table realm=all & view=1 for all content types. This meant that all domains could get access to the content even though the check boxes were set to one specific domain. I think the node_access permission logic is connected with OR.

Any guidance would be appreciated!


texts: Is there any way to change the storage size of an existing field containing data?

texts:
There is a site with some nodes and some fields. There is a plain text field already containing data.

It turns out this field length is too small.

Are there fast ways to change its storage type to text (plain, long) without losing data?


texts: How to push file to browser after theme redirect

texts:
function epa_basket_form_submit($form, &$form_state)
{
    $basket = _epa_basket_get();
    /* Direct download */
    if ($form_state['values']['radios'] == "0") {

        $wsdl =  _epa_config_get('wsdl_download_service_url');
        $options = array('features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS);
        $client = new SoapClient($wsdl, $options);
        $response = $client->GetURL(array_keys($basket['fids']));

        //drupal_set_message('<pre>'. print_r($response, TRUE) .'</pre>');
        /*Direct download*/
        drupal_add_http_header('Cache-Control', 'no-store, no-cache, must-revalidate');
        drupal_add_http_header('Pragma', 'no-cache');
        $filepath = sprintf('public://%s/%s.zip', _epa_config_get('zip_directory'), $response->URLDetails->linkURL);
        $headers = array(
            'Content-Type'  => 'application/octet-stream',
            'Content-Disposition' => 'attachment; filename="'.'europarl_download_'.$response->URLDetails->linkURL .'.zip'.'"',
        );

        file_transfer($filepath, $headers);

        /*How can i execute this line of code*/
        $form_state['redirect'] = _epa_basket_get_url('confirmation');

 }
    /*Download by email */
    else {

        $basket_entry = (object) array(
            'email' => $form_state['values']['email'],
            'fids' => array_keys($basket['fids']),
        );

        if (!epa_basket_save($basket_entry)) {
            drupal_set_message(epa_helpers_t('An error occured, please try again.'), 'error');
        }

        $basket['processed'] = true;
        $_SESSION[_EPA_BASKET_SESSION_KEY] = $basket;
        $form_state['redirect'] = _epa_basket_get_url('confirmation');
    }
}

The above function is being executed after the submit button is called.
In the the first "Direct Download" a file is being pushed to the user's browser.
How is it possible to redirect after that. A comment is in the code: /How can i execute this line of code/
What other alternatives do I have?


texts: Displaying node reference select list as ordered menu list

texts:
I want to display the Node Reference Select List (usually a long list of nodes, unordered and generally quite long) as an ordered bunch of nodes, that replicate the structure of the menu system.

The whole idea, is for a user to be able to choose another Node, but as there are so many nodes already on the website - it can be difficult to find the correct one in the select list. I have attached a screenshot to show a random example of how I would like this to look. This is just a quick mock-up image that I hope can be achievable.

The new "menu style" select list makes it easier to find the particular nodes you want, as they mirror the menu system of the website.

I looked into using Views to replicate the structure of the menu in Drupal, but this doesn't seem possible either. If this was possible, I could simple use the "Advanced - nodes that can be referenced" and just list out the pages by the menu with the order - but it doesn't look possible to integrate Views and the drupal menu system.

Any help would be excellent with this. Thanks, Garry.


texts: Highlight current user in multiple user reference field on /user page

texts:
I am displaying a block on all /user pages, that will show all upcoming events, and the staff that have been assigned to certain roles at that event.

For example...

Manager: Jake

Bar Staff: Mike, Fred, Jim

Sound Tech: James, Bill

What I want to achieve, is for every instance of a users name to be highlighted in that view, if they are logged in. So, go to Bills user page, and all "Bill" entries have an "active" class applied to them. Then, go to Mikes user page, and all "Mike" entries are given the "active" class etc.

Usually, I would name a template field for the view field views-view-field--field-manager.tpl.php and do a comparison with the current user page title, which is the current users name...

<?php

$title = drupal_get_title();

if ($title == $output) {
  $class = "active";
}

?>

<span class="<?php if(isset($class)) { print $class; } ?>"><?php print $output; ?>

But this is affecting the whole field, which is no good when you have multiple users referenced in the field.

Is there a way to target individual multiple results in a field with a tpl file?


texts: Reverse entity relationship generating weird SQL

texts:
I have an "Activity" entity and an "Invitation" entity which links to the activity by its ID (also to the invited user but that's not important here).

I want a relationship in a view where various calculations are done on the invitations to an activity.

I found this helpful question Reverse Entity Relationship for Views which gave me the core of what I needed.

Using that as a model I added this to the Invitation ViewsDataHandler:

public function getViewsData() {
  $data = parent::getViewsData();

  $data['activity']['invitation'] = [
    'title' => t('Activity invitations'),
    'help' => t('All the invitations for an activity.'),
    'relationship' => [
      'id' => 'entity_reverse',
      'label' => 'Activity invitations',

      #'base' => 'invitation',
      #'base field' => 'id',

      'field table' => 'invitation',
      'field field' => 'activity',
    ],
  ];

  return $data;
}

I omitted the base table data because the field table is the same - an invitation only links to one activity. Not that it makes any difference.

So when I create a relationship in views I get this MySQL...

SELECT activity.id AS id FROM {activity} activity
  LEFT JOIN {invitation} invitation ON activity.id = invitation.activity
  LEFT JOIN {} _activity ON invitation.entity_id = _activity.
  LIMIT 11 OFFSET 0;

And I just can't figure out why.

For completeness, here's the SELECT when I include the base table:

SELECT activity.id AS id, _activity.id AS _activity_id FROM {activity} activity
  LEFT JOIN {invitation} invitation ON activity.id = invitation.activity
  LEFT JOIN {invitation} _activity ON invitation.entity_id = _activity.id
  LIMIT 11 OFFSET 0;

I've tried other variations but I always get two LEFT JOINs, and always the extra _activity.

Just so there's no confusion, the activity field in the invitation table is called "activity", it's not called "activity_id".


texts: Help debugging "cron run exceeded the time limit"

texts:
I have written a custom module (for Drupal 7 and PHP 5.3) that utilizes hook_nodeapi() and doesn't allow access to a specific node type and simply redirects (with drupal_goto()) to the main listing page with a warning message.

However I have a suspicion that the Boost module (with "Don't cache pages with messages" enabled) chokes on cron runs when it gets to these content types and keeps getting redirected (I don't know how Boost exactly works but I guess it caches few pages on cron runs?).

The reason for my suspicion, and the real problem is that the cron, after a certain number of runs, starts failing with an error message, "Cron run exceeded the time limit and was aborted.", and immediately after this message on Watchdog there's the following message, "There are Drupal messages on this page, preventing boost from caching."

I put a debugging piece of code on module.inc (hacked core as was suggested here) to see which module was responsible for this failure, and everytime the cron fails, the last module that accessed the Cron seems to be the "Search" (core) module:

  boost  22/02/2012 - 9:00am There are Drupal messages on this ...   Anonymous
      cron    22/02/2012 - 9:00am Cron run exceeded the time limit and was aborted.   Anonymous
      cron    22/02/2012 - 9:00am hit search cron Anonymous
      cron    22/02/2012 - 9:00am hit node cron   Anonymous
      cron    22/02/2012 - 9:00am hit filter cron Anonymous
      cron    22/02/2012 - 9:00am hit dblog cron  Anonymous
      boost   22/02/2012 - 9:00am Expired stale files from static page cache. Anonymous
      cron    22/02/2012 - 9:00am hit boost cron  Anonymous

I have since then reduced the number of pages to index but it didn't help. The cron that runs after the Search cron is the "System" cron but I have no idea what exactly this cron does.

The annoying thing is when you access the cron page through typing in the browser http://address/cron.php or through commandline wget http://address/cron.php it runs Ok. But from the system's cron jobs it eventually runs into this problem after few successful cron runs.

I would appreciate any help in getting to the bottom of this problem or a push in the right direction. Thanks.

/**
 * Implements hook_nodeapi().
 */
function rhask_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'view':
      if($node->type == 'question' && arg(0) == 'node' && !user_access('administer questions')){
        drupal_set_message('Access Denied - You cannot access this content directly. Please use this page.', 'warning');
        drupal_goto('ask');
      }
      break;
  }
}

I guess I could do a redirection without setting any message. That might solve it if indeed Boost is causing problems with the cron, I'll edit this post when I get any result by doing so.

Edit:
The cron has been running successfully every 30 minutes since yesterday and the change I've made to the XMLSitemap module's settings seems to have done the job. I will continue to monitor this website for few more days.

Edit2:
Cron still fails. I've removed the drupal_set_message so now it redirects without setting any messages. However it doesn't prevent the cron from failing. Boost doesn't complain anymore and just logs that "Expired stale files from static page cache". I don't know how to proceed from here to isolate this problem.


texts: Adding META tag to nodes with a specific topic

texts:
If a node has a term reference to a specific term (say termid 123) I want to add this META tag to prevent search engine spiders from indexing the page:

<meta name="robots" content="noindex">

Is hook_page_build() the right hook for this?


texts: Drupal - Update Statistics label from "read" to "view" and "reads" to "views"

texts:
As the subject suggests I'm attempting to update the statistics title via a theme_preprocess_node function to read 'views' instead of 'reads':

function mytheme_preprocess_node($variables) {

  $content = $variables['content'];
  // Check the node  type to make sure
  // we have the one we want

  $content['links']['statistics']['#links']['statistics_counter']['title'] = str_replace('reads', 'views', $content['links']['statistics']['#links']['statistics_counter']['title']);
}

This isn't working but I cannot see why.
I also don't want to use the stringoverrides module as I use 'read' and 'reads' elsewhere on the site.

Thanks


texts:
I have taken over the maintenance of a site that was built with Drupal 6.x

Prior to this I have no Drupal experience, so I am rolling up my sleeves and getting stuck into how Drupal works, with vcarying degrees of success.

My problem is this:

There is a menu on the site which I would have presumed was primary navigation, but it turns out to be a block.

I need to edit this menu, but there are no options to do so under blocks, there is a configure button beside it, but this does not allow me to edit its content. There is no delete option shown either, as I notice some blocks have this option and others dont.

Any ideas where I can find the content of this block so that I can edit it?


texts: Getting taxonomy name from entity for computed fields

texts: Im trying to create a computed value field using the the computed_field module.  I trying to do something like http://drupal.org/node/792922 but that example is for drupal 6.  Can someone point me in the right direction of how to do this with drupal 7?


texts: Use administration views module with commerce kickstart

texts:
I need to bulk update a custom field in my product display.

Usually I would use the administration views module to achieve this. However, Commerce Kickstart does not seem to allow the 'operations' to display. I guess this is somehow being overridden by the backoffice functionality of Commerce Kickstart.

Any ideas how to get Admin Views working with Kickstart?


texts:
I'm creating a Drupal 8 module which require to present data in table-grid manner
something similar like below:

The data will be retrieve in JSON format from REST API service (another server) - which I've done this part using

self::$client = \Drupal::service('http_client');`
$result = self::$client->request($method, $full_uri, $data);
$output = json_decode($result->getBody()); // <-- i manage to get my result here
//But then, how do i present the data in table-view?

Is there any Drupal API to present the data in Table Grid as image above??

Note:  I need the operations also, so not just rendering the data in a table format. These operations should be present in row, at the end column, where there should be edit (which will go to edit page) and delete (which will give confirmation dialog then delete once it's confirmed).


texts: db_insert in Drupal 7 without field names

texts:
I have the following INSERT in a db_query, but feel like I should convert it to a db_insert, but can't figure out the syntax:

INSERT INTO {mytable} VALUES (23, 'foo', 'bar', 42)

This example is fairly short, but I do work with some legacy tables that have MANY fields.

$insert = db_insert('variables')->values(array(23, 'foo', 'bar', 42));
$insert->execute();

The above gives me "NoFieldsException: There are no fields available to insert with. in InsertQuery->preExecute()".

How can you perform an insert with db_insert without needing to specify each field name?
I can make it work in D7 with db_query([INSERT...]); but drupal_write_record does not work.


texts: How to render a Drupal 7 field in stand alone PHP file?

texts:
Hi this is probably a really basic question, but hopefully you guys can help me out...

I have a javascript client application (Separate to my main Drupal 7 website) and rather than maintaining a duplicate select list with a large number of values, I would like to use an AJAX call to a PHP file on the Drupal server which will render the HTML for the list I need.

The list is configured as a custom field (Text List type).

Can I create a PHP file in the root of the website, and include the required module files?

An example would be fantastic!

Thanks!


texts: Multi-site with two sites sharing the same domain?

texts:
There is absolutely no problem to have multi sites, where:

domain1.com points to site A
domain2.com points to site B

But I want to have multi-site setup, where:

domain1.com points to site A
domain1.com/blabla points to site B

I was doing everything to solve it, for example using directory structure like that:

domain1.com
domain1.com.blabla

or using file sites.php with content:

$sites = array(
'domain1.com' => 'domain1.com',
'domain1.com' => 'domain1.com.blabla',
);

Nothing works, site 'domain1.com' takes all traffic.

FYI:

I'm using nginx.
I'm using Drupal 7.
I do not want to use the module Domain as I want to have separated databases.

Please help!


texts: Assign programmatically created order to anonymous user

texts:
I want to create a pre-made order in Drupal Commerce for an anonymous user, and redirect the user to the checkout.

My use-case is that I have two sites: One big Drupal Commerce site (up and running since 2011), and another site that sells a few very specific products. The second site is not a Drupal site.

Ideally I want users on the second site to be able to select a few products, click "checkout" and be redirected to the checkout page on the Drupal site, with an order that contains the products that he/she selected on site two.

Now, selecting products etc. won't be an issue (second site has access to all product data via Services API), but I have no idea how to create the order for the anonymous user in Drupal and make it belong to him/her.

I read this blog entry which could've been of use (send user to page that creates the order and then redirects user to checkout) but apparently that doesn't work for anonymous users.

Any help would be greatly appreciated!


texts: The best way to render field content without any  wrapper

texts:
I have a content type with filefield "ttf" wich I want to render as Url to the file .
with this url to file I want to create an link :

<a href="<?php print render($content["field_ttf"]); ?>">Download

But this output a wrapper around the url

I know that there is a function field_view_field() that do the Job but I'm looking for a better solution


texts: Adding node edit links to a views block display?

texts:
I have a View with a Block display which shows 4 nodes of 1 type. I'd like to add node/xx/edit links to each node on the block. I've searched Google only to get confused more. Which hook to use? views_pre_execute, views_pre_render, views_pre_view .... And once you get the right hook, how do you actually add those links? Obviously I'd like to check the current user's node_access permissions too before adding those links.

This is Views 2 with Drupal 6.


texts: alter Suggestion box for apache solr autosearch

texts:
I want to restrict the suggestions for Apache Solr Search with hook_apachesolr_suggestions_alter(&$suggestions, $env_id). I have gone through the code and found the suggestion is prompt from apachesolr_autocomplete_suggest_word_completion()
called by a menu callback.

How can I override the suggestion block? I do not want to block indexing the words but just to hide them from suggestions.

Is there any hook available? Is hook_apachesolr_suggesstions_alter(&$suggestions,$env_id) useful in this case?

I am using hook_apachesolr_querry_alter(DrupalSolrQueryInterface $query);
I want to skip the parameters from the query. Is there any way to do  this?


texts: Is there a hook after user confirmation?

texts:
I want to add a content type after a user registers to the site.

I tried hook_user_save() but it saves the content type before the user confirms his e-mail.

Is there a hook after e-mail confirmation?


texts:
similar issue to
Drupal 7 Views - Date Filter Cannot See Year

However I verified the format being used is the short date format and in the datepopup.module file, I made sure it was set to m/d/Y but I'm only seeing the month and day.  Under Filter Criteria>Settings>Filter granularity = Year, it displays ok.

Currently running Views, Date, and Calendar modules in this setup.
Last year someone made a patch but it no longer works

Any help is greatly appreciated!


texts: How can I update a module to a specific version using Drush?

texts:
I am trying to update module entityform 7.x-1.4 to entityform 7.x-2.0-beta4.

The current version of the entityform module is 7.x-2.0-rc4. But I don't want to update at this version.

Can we update module at specific version using drush?


texts:
I want to build a front page in which the site administrator has a lot of control (through the UI) over the layout. Panels is the only thing that comes close, but I still don't think it can do everything I need (and admittedly, I'm not a big fan of panels).

requirements

The front page will have a couple of sections; I'll call them "news", "products" and "store" in this example. The administrator must be able to control the order of the sections on the page.

Each section will contain a selection of news nodes for the news section and a selection of products for the products section. (The nodequeue module would be an obvious choice here.) The order of the nodes can be controlled by the administrator too. Also, the admin must be able to choose if a node is rendered full width, or if two are rendered half width, placing them side-by-side.

The "store" section must contain a maximum of 4 blocks (not nodes). The admin must be able to make a selection out of 6 or 7 blocks and gain control the order.

question

I'm sure I can make this work all by myself, but I'm curious: Which module (or combination of modules, if any) would you use to accomplish this? Needless to say, I would like this to be as easy and user friendly as possible, preferrably with as least different forms and interfaces as possible.


texts: How to enable Ckeditor for email templates?

texts:
I have installed HTML Mail module, to send HTML emails and it is working fine and sending email in HTML format. Now i wanted to load CKeditor for email templates textarea, as html email will be handled now.

I have googled it, but didn't find any solution yet. Is there any way I can enable the ckeditor for system email templates and webform email templates.

-- Thanks for your time.


texts: How can I create another user login block?

texts:
I would like the user login block to be standard on the front page, but a link on all other pages. The best way I can think of doing this is having two blocks and restrict them through the block setting.

Is there another way to do this? I have considered fancy login since that gives another login block, but I was curious if it's possible to clone the core login block. Thanks for reading.


texts: What is the correct ways to add themes to a profile within an Aegir install

texts:
I have Aegir installed with a two platforms. I'm interested in adding some additional themes/modules to the platform. Normally I might do this through Drush, but when I log into the server, I am logged in as Root not as Aegir (I don't believe you can log in a Aegir).

What is the best approach to adding themes and or modules? Should I simply upload via FTP and then make sure that I change ownership of the files?


texts: Display language in entity reference field

texts:
I am running a multilanguage website and I have some content types using entity references. Now, the problem is that when I am adding content, if I have two content with the same name but different languages (a product name for instance), I have no way to know which one I am choosing in the entity reference field.
So I want to be able to display language in the entity reference select box. Something like this :

Lorem Ipsum (EN)
Lorem Ipsum (IT)
...

Is there any module I can use for that or some hooks?


texts: How to create language object from language string (e.g. 'en')?

texts:
As in question, ofcourse I am asking about Drupal function for this job.

So I need function that get language string as param (e.g 'en','pl' etc) and returns me standard Drupal language object. Similar to global $language.


texts:
I've setup a site for a client I want them to have access to edit content, but some of the permissions grant too much control for my liking. Can someone give me a way to be a bit more selective with permissions. These are my areas of interest.

I have a custom block which contains 2 editable fields, To allow access I have to grant access to Administer Blocks, which give the user access to reposition the block, I would like this to disabled, and also the Regional and Visability settings to be disabled.
When editing a Basic Page node, I have an image field which I dont want the user to be able to adjust.

Any clever people out there know the answers?


texts: Passing arguments with special characters

texts:
I want to pass a token into my custom module via the URL, like so:

http://example.com/myurl?token=ffjei4T93F/ggF0PImZxlDWSR8JYHaPmkkjLSUVSKkr

Drupal has issues with passing tokens using clean URLs:

https://www.drupal.org/node/118072

...and because my token has a '/' forward slash in it it breaks if I use arg(1) to get the token.

What to do?


texts: Unexpected class in ControllerResolver.php on line 151

texts:
I'm working with Drupal 8 for the first time, though fairly well experienced in 7.

I have a site working on a localhost environment just fine, and I am attempting to get it working on Go Daddy (I know they are not well regarded, but right now I need this to work.)

The entire code-tree on the localhost and server are identical. They both connect to the SAME mysql database, hosted on GoDaddy. The database is fine.

When I try to load the site from the GoDaddy host, I get the following error.

  Parse error: syntax error, unexpected 'class' (T_CLASS), expecting
  identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in
  /home/content/01/9224501/html/mysite/drupal8/core/lib/Drupal/Core/Controller/ControllerResolver.php
  on line 151

So far, from googling the error, it seems to result from a failed database connection. I'm not sure why the same code would connect to the same database just fine from one place and not from another.

The db connect code from settings.php is here:

$databases['default']['default'] = array (
  'database' => 'mydb',
  'username' => 'mydb',
  'password' => 'mydbpwd',
  'prefix' => '',
  'host' => 'mydb.db.9224501.hostedresource.com',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

For what it's worth, this is the code in core that generates the error.

protected function doGetArguments(Request $request, $controller, array $parameters) {
$attributes = $request->attributes->all();
$raw_parameters = $request->attributes->has('_raw_variables') ? $request->attributes->get('_raw_variables') : [];
$arguments = array();
foreach ($parameters as $param) {
  if (array_key_exists($param->name, $attributes)) {
    $arguments[] = $attributes[$param->name];
  }
  elseif (array_key_exists($param->name, $raw_parameters)) {
    $arguments[] = $attributes[$param->name];
  }
  elseif ($param->getClass() && $param->getClass()->isInstance($request)) {
    $arguments[] = $request;
  }
  elseif ($param->getClass() && $param->getClass()->name === ServerRequestInterface::class) {
    $arguments[] = $this->httpMessageFactory->createRequest($request);
  }
  elseif ($param->getClass() && ($param->getClass()->name == RouteMatchInterface::class || is_subclass_of($param->getClass()->name, RouteMatchInterface::class))) {
    $arguments[] = RouteMatch::createFromRequest($request);
  }
  elseif ($param->isDefaultValueAvailable()) {
    $arguments[] = $param->getDefaultValue();
  }
  else {
    if (is_array($controller)) {
      $repr = sprintf('%s::%s()', get_class($controller[0]), $controller[1]);
    }
    elseif (is_object($controller)) {
      $repr = get_class($controller);
    }
    else {
      $repr = $controller;
    }

    throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument (because there is no default value or because there is a non optional argument after this one).', $repr, $param->name));
  }
}
return $arguments;

}

Line 151 is the 3rd elseif statement.

A similar error that I already solved was a result of GoDaddy defaulting to PHP 5.3, which was not supported by Drupal 8. I upped it to 5.4.19, which is the only other option they offer.

My localhost is running PHP 5.5.9. I hope this is not the problem because there won't be anything I can do about it.


texts: delete scheduled tasks fails when task identifier is account:uid

texts:
I have an action set as a scheduled task that deletes a user, that seems to be working fine:

{ "rules_delete_unregistered_user" : {
    "LABEL" : "Delete unregistered user",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "user" : { "label" : "user", "type" : "user" } },
    "ACTION SET" : [ { "entity_delete" : { "data" : [ "user" ] } } ]
  }
}

and I also have a rule, that should delete this action set, but it fails:

{ "rules_user_accepted" : {
    "LABEL" : "user_accepted",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_scheduler" ],
    "ON" : { "user_update" : [] },
    "IF" : [
      { "data_is" : { "data" : [ "account:field-accepted" ], "value" : "1" } }
    ],
    "DO" : [
      { "schedule_delete" : {
          "component" : "rules_delete_unregistered_user",
          "task" : [ "account:uid" ]
        }
      }
    ]
  }
}

now I do not have any idea what should I use as a task identifier to delete that action set.

EDIT:

the rule that schedules the action set:

{ "rules_create_new_user_after_registration_form" : {
    "LABEL" : "create_new_user_after_registration_form",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "new user based on webform" ],
    "REQUIRES" : [ "webform_rules", "rules", "php", "rules_scheduler" ],
    "ON" : { "webform_rules_submit" : [] },
    "IF" : [
      { "webform_has_id" : {
          "form_id" : [ "form-id" ],
          "selected_webform" : { "value" : { "webform-client-form-104" : "webform-client-form-104" } }
        }
      }
    ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "user",
            "param_field_lastname" : "[data:lastname1-value-raw]",
            "param_field_firstname" : "[data:firstname-value-raw]",
            "param_name" : "[data:email-value-raw]",
            "param_mail" : "[data:email-value-raw]"
          },
          "PROVIDE" : { "entity_created" : { "new_user_request" : "new_user_request" } }
        }
      },
      { "entity_query" : {
          "USING" : {
            "type" : "user",
            "property" : "uid",
            "value" : [ "new-user-request:uid" ]
          },
          "PROVIDE" : { "entity_fetched" : { "user_fetched" : "Fetched entity" } }
        }
      },
      { "schedule" : {
          "component" : "rules_delete_unregistered_user",
          "date" : { "select" : "site:current-date", "date_offset" : { "value" : 60 } },
          "param_user" : [ "user-fetched:0" ]
        }
      }
      }
    ]
  }
}

this actually works fine.


texts:
I need a tagging functionality for my content type. The normal term reference tag autocomplete widget has a problem, because I can't find a way to use textarea instead of textfield for it. I would need textarea to be able to see all tags while typing them. One node will have 10-20 tags, some of which are not just words, but expressions. So it all takes place and textfield is not acceptable.

How to enable entering tags into textarea with autocomplete?


texts: How do I diagnose a unstable installation on ubuntu 16 server?

texts:
I'm deploying a site to a Digital Ocean Ubuntu 16 server. I'm using PHP 5.6, but otherwise using the default versions of the necessary database software. The site functions; however, I frequently have database related errors, specifically, the following one:

  PDOException: SQLSTATE[HY000] [2002] Connection refused in lock_may_be_available() (line 167 of /var/www/html/phisigmarho.org/includes/lock.inc).

I usually get that error, but I also get "the website experienced an error" errors when I to do anything database or process intensive (updating modules through the UI, etc). I'm relatively new server administration, so I'm not sure what could be wrong or which logs I should be looking at for clues to what's wrong. For the moment, restarting MySQL from the terminal is letting me move forward with setting up the site, but I can't let anyone use the site the way that it is now.

How do I figure out why MySQL keeps going away?


texts: How to reload Google chart on ajax submit?

texts: I have a simple Drupal form. I am using hook_theme() to draw a chart right under my form. I am using Google chart API. When the page loads first time, my chart appears with no problems. But when I submit my form I use ajax_command_replace() to replace my chart with another one (without page reload). The goal is to make it possible to send variables from my form right to my theme function and draw another chart according to them. The problem is when I push the submit button the old chart disappears (which is good) and the new chart doesn't appear (which is bad). What am I doing wrong?


texts: Applying javascript to an ajax quicktab result

texts:
I have made an interface with some quite sophisticated functionality - tabs (module Quicktabs), containing views (module Views) from nested taxonomy (module views tree), containing tables which are views (module Views field view). All very satisfying and really demonstrates to me the power of Drupal.

Since the tabs are such heavy-weight views, I am loading them with AJAX. I want to apply some JQuery operations to the views after they have loaded - things that don't seem possible to do within views itself (removing elements of the taxonomy tree that don't contain tables) but are very easy to do with JQuery. My question is - how do I efficiently execute the Jquery after the AJAX tab has loaded? I'm guessing I need to add the following into the theme:

$( document ).ajaxComplete(function() {
    // apply jQuery here
});

but this seems like it might be very inefficient (getting called every time ajax is used anywhere on the site).

Any advice gratefully accepted!

Drupal rocks - it's amazing what you can do without having to dig into the code.


texts: Link “My Workbench” is no longer visible

texts:
I have installed Workbench and the Workbench Moderation modules, but My Workbench(on top with other Administration Menu) link is coming only for when user logged in as Administrator, it is not visible for user with Editor role.
I have given following permissions to Editor
Workbench

Administer Workbench settings

For Editor:
Administer Workbench settings - Yes
Access My Workbench - Yes


texts:
I have an interesting use-case.

I have to import a lot of documents (+100) into a specific content type called "Resource".
This content type consists of few taxonomy fields (mapped to a vocabulary), some textfields and PDF file.

What should be the strategy when using Feeds module. Is it possible to have multiple taxonomy terms per field ?


texts: Modules to extend the Display Suite module?

texts:
Just that. I find the Display Suite module really useful for my projects.

Are there more modules to extend its functionality in any way?

Thanks.


texts: How to troubleshoot Rules when a required variable for an event is not provided?

texts:
I'm seeing a strange behavior on my site and I'm trying to figure out how to correct it.

I have a rule that triggers on the event After updating an existing user account.  This rule uses two variables, account and account-unchanged.  Both of these should be provided by default.

However, for some reason user accounts are being saved upon login-- and when they are saved at login, account-unchanged is unset.  This leaves a PHP warning in watchdog.

To remove this error, I attempted to add a condition, Not data value is empty (account-unchanged, but this just gives me another watchdog warning like so:

  Unable to evaluate condition data_is_empty.

Ideally I will be able to find the reason why user accounts are being saved on login, but in the meantime, is there a way to prevent the rule from being evaluated when a required variable is not set?


texts: How to import allowed values lists into Drupal 8?

texts:
I have a Drupal 6 site, with some fields that allow you to pick from a list of allowed values. These values are then stored/linked to the node/entity. After migrating from the old site, these values are still stored/linked to the node/entity, but the field itself does not have a list of allowed values. So if I edit a node that has this field, I can't pick anything from the list.

I can re-create the list of values (which get keys automatically generated to be the same as the values) but that seems like the wrong thing to do. Does anyone know how I can simply migrate the existing list into Drupal 8 properly, or where these key/value pairs are stored so I can just create some SQL scripts to populate them instead?


texts: Drush hangs out on dl commerce_kickstart

texts:
in recent days new version of Commerce Kickstart 2 was introduced (v2.55).
I tried upgrading my current installation (v2.54) using drush:

drush --debug dl commerce_kickstart

unfortunately after this line:

Verifying signature for bzr version control engine. [3.27 sec, 42.21 MB]
Executing: bzr root profiles

I'm stuck with this , please give any some tips.
I'm using 7.4.0 drush version.


texts: Can't update hook_theme after clearing the cache

texts:
I have a hook_theme instance in my template.php which outputs various components in my theme. I want to add an extra argument to one of the templates but no matter what I do it doesn't update. I have cleared the cache (using drush and not), removed the theme array, cleared cache and added back in. I have even truncated all the cache tables - but somehow it's still picking up the old function. Is there something stupid I have missed?

template.php

function MYTHEME_theme() {
  return array(

    'featured_blocks' => array(
      'arguments' => array(
        'blocks' => NULL,
        'image_format' => 'test!',
      ),
      'template' => 'featured-blocks',
      'path' => drupal_get_path('theme', 'MYTHEME') . '/templates/other'
    ),

  );
}

featured-blocks.tpl.php

<?php

printr($blocks); // blocks are all here
print $image_format; // this is undefined!!!

Calling the hook theme

<?php print theme('featured_blocks', array(
            'blocks' => $wrap->field_my_blocks,
            'image_format' => 'this is a test'
          )) ?>


texts: "Allowed memory size" errors on common tasks

texts:
I get this error all the time when I'm doing common admin tasks, such as enabling modules.

  PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted

How can I fix this?


texts: Access denied for admin page, after moving site from sub-folder to root folder

texts:
Not able to access administration site after moving files from sub-directory to root folder.

With the help of google search, I have made below changes in settings.php under default folder, but that also didn't helped.
$base_url = 'http://example.com'; //Changed to site name

Actually base_url is commented in my settings.php file, I have tried enabling it.

Drupal version: 7


texts: Which module facilitates looking up database schemas of custom content type?

texts:
I am setting up some reports using DB API to query custom content fields, and rendering them in tables and charts. I am looking for a way to easily look up the names of tables and fields in the Drupal DB.

My Question: Is there a Devel-type module that provides an easy reference of the live DB schema?

Currently I'm using drush sql-cli and/or phpmyadmin, so the solution should be something simpler than that.


texts: CKFinder - Clicking 'send it to the server' when uploading an image does nothing

texts:
I am trying to get CKFinder to work correctly. The file manager and related functionality is recognized.  When I click the little image in the toolbar to upload a photo the window comes up properly. I then select 'upload, browse (to select the file)' and then I click 'Send it to the server.'

At that point, nothing happens - the upload / file field disappears and greys out.

Nothing is actually uploaded, so, upload is not working.

Any thoughts as to why this might be happening?


texts: RESTful web services 500 or 406 Error when "£" is in a value

texts:
I'm using RESTful web services and Node.js to export a Mongo database into Drupal. This is working fine, however I get the occasional 500 or 406 error. I've narrowed it down to a "£" sign. In node I'm doing an http request using the below. All this works fine apart from the £ sign. Do I have to do a character replace for each string or something?

...
var req = http.request(options, function(res) {
    res.setEncoding('utf-8');
    ...

This is the JSON:

{
    "type": 'primary_whatson',
    "field_parent_article": {
        "uri": 'http://tp/cms/node/702',
        "id": '702',
        "resource": 'node' },
        "field_whatson_theme": {
            "uri": 'http://tp/cms/taxonomy/term/385',
        "id": '385',
        "resource": 'taxonomy_term'
    },
    "title": 'Test',
    "field_body": {
        "value": '
test.
',
        "summary": '',
        "format": 'filtered_html'
    },
    "field_ticket_price_v": "Tickets free-£9.00"
}


texts: Where to insert .js code using the webform module for google tracking a submit button?

texts:
I am trying to insert a google tracker to a form submit button/form using the webform module (drupal 7).  Here is my code:

Drupal.behaviors.basicWorks = function(context) {
  // Track submission events.
  $('#webform-client-form-198', context).submit(function() {
    ga('send', {'hitType': 'event', 'eventCategory': 'PDTestlinktoDrupal', 'eventAction': 'clickAction', 'eventLabel': 'PDConversionTest' });
  });
};

My question is:

Where do I place this code?  Inside the webform.js inside the /js folder?  Or do I create my own file inside the /js folder and upload?

Been working on this issue for a few days now and I could really use some insight.


texts: How to append text of user input for affiliate marketing URL?

texts:
I'm a site administrator/content manager who wants to add functionality to a Drupal 8 site. I do NOT have a background in development (though I can  make small  modifications to code).

I am creating a product review site which reviews a certain kind of consumer product. The review form has a field for link to one particular  ecommerce site. (not amazon.com, but like amazon).

This ecommerce site runs an affiliate marketing program which allows me to earn affiliate fees if my referral results in a sale.

I need all input of user URLs to  append the code for my affiliate marketing account at the end of the URL ie. ,

One field in this review form will be  othercommercesiteURL

When the user inputs http://www.othercommercesite.com/product3153.html into the form, I want the data to be stored (and displayed) as http://www.othercommercesite.com/product3153.html?ref=myaffiliateaccount.

Ideally, I'd need to check first if the user input URL doesn't already include the affiliate suffix, but I'd be happy with a way just to append this suffix. Because the URL will inputted in a form field labeled "Othercommercesite.com" I know the URL's are all going to go to this site.

How to accomplish this? Is there anything in Drupal 8 that already have this functionality (or something similar)?


texts: Create a block Most popular content using google analytics

texts:
Can anyone explain how to create a block of most popular contents using google analytics. I know about the modules Google Analystics Statistics and Most Popular but there is no good documentation about this.

How can I get any of these module to work?


texts: How to send notifications with rules to users with access permission to view content?

texts:
I have a rule to send an html mail when new content is created, but is not respecting the user permission to access content.

Is an Open Atrium site that works with OG. I have a space with 7 teams and only team members can view team contents (7 sections asociated to 7 teams). All users have the same role (filter by role is not a solution for me).

The content type in question have two entity reference fields: group audience and section (one per team).

In the rule I have an action to "Get group members" but I do not find the way to get only team members. If the solution is not with the teams may be something like filter or validate the value item-list:mail with the permission of the user to access to the content? It is possible to do something like that?

Any help is very apreciated, thanks!


texts:
I am using views to show some published content. I would like to give users with the role preview the ability to see all content within the view – published and unpublished. So they can preview how the page would look like after publishing content. My thoughts: I need to add a filter-criteria:

Published (=Yes)
 OR
Current-User-Role (=preview)

Ideas?

edit #1: to make it easier, I could also allow to see the content for all authenticated users.

edit #2: I have about 15 views where I need the preview functionality. they have different structure (filter criteria, viewmode, context etc) that means I need to keep it flexible. means probably that I need to define a filter and validate the data in the template.php


texts:
I'm building a Drupal site that uses nodes to display a number of high value products. There are no e-commerce features due to the high value of the products being offered for sale, but the client wants a quote form on each product (node) page so that a potential buyer can enter some brief information and click to send a quote request for the item that they are viewing.

To make it clear, I have a content type called "Product", and I want this quote request form to be on each page and pre-loaded with the name of the product that that page is listing... it's not important whether the form is embedded in the node itself or displayed in a block, but it is important that the name of the product be preloaded in the form.

Following the form submission, ideally it would send an email to the website contact address.

I've considered using the entity form module and embedding the option to select a form in a node, but I don't want the client to have to manually create a form for each node.

Any ideas about how to create this functionality?


texts: Create a related content block which sorts the nodes of related content by how many tags they share?

texts:
The options in a views Advanced tab seem to only allow:

Multiple-value handling
Filter to items that share all terms
Filter to items that share any term

and I'd like to show items that share any term but sort by showing the items sharing the most terms at the top. Sort of like a "relevant" sort filter?


texts: I want to use field collection module in Webform Component, How can I do that?


texts:
I am newbie to Drupal. I am trying to install booking timeslot module in D7. I've installed 7.x-1.x-dev version. However, I fail to enable the module.

The description for the booking time slots as below:

  Provides features for Booking Time Slots
  Requires: Booking Timeslots (disabled), Addressfield (missing), Calendar (enabled), Views (enabled), Chaos tools (enabled), Date API (enabled), Date Views (enabled), Date (enabled), Entity (missing), Entityreference (missing), Features (missing), Hierarchical_select (missing), Hs_taxonomy (missing), Hs_taxonomy_views (missing), List (enabled), Field (enabled), Field SQL storage (enabled), Options (enabled), Number (enabled), Opening_hours (missing), Taxonomy (enabled), Text (enabled), Workflow (missing)

Can anyone help to tell me what to do so that I can enable it?


texts: My webhosting won't allow "Options" in .htaccess

texts:
My webhosting provider of 4 years said they don't allow "Options" in .htaccess files. They were referring to lines 11 and 14 of the .htaccess file. Is it ok to comment these out?

These lines are

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

Does it pose a security risk?


texts: How can you add the ID to the content type fields?

texts: All I see are classes, and from my understanding seems that there is nothing in the variables.


texts:
We are using the Feed Display for a view where we want to display all Articles in a rss.xml file. Below are the View settings. However, we cannot find a way to add an image attribute that meeting the RSS 2.0 specs.

How can we add an image to the RSS feed display?

View settings:

Format: Rss Feed
Show: Fields | Settings
Fields: content: title, content: body, tracker: updated date, content: link to content, content: authored by
Feed settings: path = some/path/rss.xml
Filter criteria: published = yes and Content type = Articles

When you click on settings in the Show section, we assigned the fields.

title field -> content: title
link field -> content: link to content
description field -> content: body
creator field -> content: authored by
publication date field -> tracker: updated date

What we tried:

Include field_image under fields and hide from display
Rewrite the output of the body to include the following <enclosure url="{{field_image}}" length="100" type="image/jpg" />
The {{ field_image }} is the available token after reordering field image under Fields section so that it is above body field.

Results of what we tried:

<description>some body text  **blank space where <enclosure> should display** </description>

Expected output (cannot get this result because <enclosure> is stripped even when Strip HTML is false):

<description>some body text</description>
<enclosure url="{{field_image}}" length="100" type="image/jpg" />


texts: How to change datatype of field in database table from varchar to int?

texts:
I have created custom table. Now I want to change datatype for a particular column in table. Column name is 'session_number' and its current type is varchar. I want to change it from varchar to int. I used this to do so :

function mymodule_update_7053(&$sandbox) {
  db_change_field('abc', 'session_number', 'session_number', array(
    'type' => 'int',
    'size' => '255',
    'not null' => TRUE,
  ));
  drupal_flush_all_caches();
}

It doesn't change existing type from varchar to int. How to do it please guide.


texts: Unflagging (by rule) doesnt show rightaway

texts:
I have 3 flags in my custom content type "Movie"
Seen , Unseen , Want to see...

these 3 flags are mutually exclusive , that is if a user has "seen" a movie he cant "unseen" the movie..

To make the flags mutually exclusive I have added rules , so whenever one of the flags are flagged, the other 2 are unflagged.

Now my problem is, when i flag a movie with say "seen" , the other 2 flags "unseen" and "want to see" are unflagged internally, but that unflagging effect is not visible on that page right away. When i refresh the page , then i can see those changes.

How can , i see the changes right away ??


texts: WYSIWYG module w/CKEditor not working drupal 7

texts:
I am unable to get WYSIWYG working with my Drupal 7 installation.

I watched a screencast to ensure I installed the module and library correctly, and everything appears to be properly installed. My host has PHP4 by default, but I am able to enable PHP5 and have done so.

The module is installed at: /www/drupal/sites/all/modules
The CKEditor library is installed at: /www/drupal/sites/all/libraries

I have enabled WYSIWYG as the screencast demonstrated and receive no error message at all. I enable and configure the module exactly as it's done in the screencast, yet when I go to edit the plain text version is still there.

I've tried CKEditor on it's own but kept running into a tmp file issue that I could not resolve so abandoned the idea.

At no point is there error text. It just doesn't work.

I have tested this in Chrome and IE9. I have also tried various other libraries and there is no luck. I tried TinyMCE and FCKEditor too.


texts: Open a view getting nid from previous view

texts:
I have two view. One is a Gallery view and the other is a
view with exposed filter with which i choose field_gallery[nid] to make operations into some editable fields.What i wish to Know  is if i can add a link in the first view with which open second view calling the [nid] of the first.
Do you think is possible?


texts:
I want to do the following:

filling content (create new content)
after pressing the save button (submit) will display the contents of the data has been filled,and other additional information required
select save to submit the content, or cancel it

How do I show data that has been filled as a confirmation before the data saved?

I have tried using the Form API to change the flow of the process (_form_alter) but no success. And i can't find the examples to altering the content type.


texts:
I have a Drush script that I am running from my Drupal environment which loads a particular module that I want to get access to.  Particularly, I want to use one of the functions it has defined in one of it's included files.

I tried just calling the function in my script, but PHP fails with an error citing an undefined function.

I am running the script as follow:

drush php-script ~/path/to/script.php

And this is my script in its entirety right now:

<?php
    $val = biblio_get_contributor(1);

    print_r($val);
?>

biblio_get_contributor($aid) is most definitely defined in the module.

So to sum up, I need to get this module's functions loaded somehow.  Thoughts?


texts: View of Quiz questions Grouped by their Quiz?

texts:
How do i build the following View configuration:

Group quiz questions by their assigned Quiz
Display Quiz title above each grouped list
Display only One question per group and link question to the Quiz Take Page (All questions in one list. I have "Quiz Pages" module configured.)

Wireframe block:

Quiz1

Question (link to quiz1 questions list page)

Quiz2

Question (link to quiz2 questions list page)

Quiz3

Question (link to quiz3 questions list page)


texts: How to convert an image field to an entity reference field

texts: We have Drupal Paragraphs using image fields that are media entities. When the media entity is updated with a new image the old images still show unless we manually edit each page, remove the image from the paragraph, and add it back. We have tested using entity reference fields that reference those same media entities and they update. How can we programatically convert the image field to an entity reference field or copy over the references from that field to the media entity field?


texts: Why do I have to enter a recipient after selecting users in the VBO send emails operation?

texts:
I'm using VBO module in D7. I created a table view listing users by some filter criteria. I want to send a mass mail to selected users. I'm using the VBO field bulk operations: user and selected the send email functionality. The view looks like that:

Selecting multiple users and hitting the send email execute button brings me to this form:

Why do I have to enter a recipient after selecting users in the view? What does that send email operation do if not sending emails to the selected users?
Is it my fault and I messed up the installation or did I miss some settings or configurations?


texts:
I'm having an insane problem enabling shortcut icon in my theme. When I dpm theme_get_setting('favicon') and theme_get_setting('toggle_favicon') - I get null strings, even though in the Shortcut icon settings section of admin/appearance/settings I have the favicon.ico as the value of the path to custom icon (obviously, the default shortcut icon checkbox is blank).

This lead me to inspecting other themes setting pages (eg. admin/appearance/settings/bartik) and I found out that all of them display a full set of options while my theme has only one checkbox. See the attachments below:

Bartik theme settings

My theme settings

Comparing the info files does not lead me to any findings.

The following is the info file of my theme:

name = SI 2012
description = SI Startup Theme
package = Core
version = VERSION
core = 7.x

features[] = main_menu

stylesheets[all][] = [...]
scripts[] = [...]

regions[offtop] = Off top
regions[header] = Header
regions[highlighted] = Highlighted
regions[help] = Help
regions[content] = Content
regions[sidebar_first] = Left sidebar
regions[sidebar_second] = Right sidebar
regions[footer] = Footer
regions[offbottom] = Off bottom


texts:
I have a field which is used in a nodeblock, and only appears on a few select pages. This however will vary throughout the lifetime of the website so I've been looking for a way to insert the Javascript this field requires only when it's present. Additionally, the field can appear more than once on any given page.

Looking at drupal_add_js, I can't see that it provides a way to only include JS once. Using this I was hoping that I could just call it in the field--field-name.tpl.php file for that field but as it occurs multiple times, the JS is included more than once.

I've looked at the module JS Injector, but that's just page specific and just calls the aforementioned function. This wouldn't help me because every time a new block is added somewhere, the list of pages including the JS would also need to be updated.

Is there a way I can include a JS file just once in Drupal?


texts: How can I label content in views as "new"?

texts: I use a panel with views on the home page of my drupal site (workaround.org). But I would like to put a "new" label in front of any article that was created or edited in the past 2 weeks. The view field "Node: has new content" did not help me because it will flag any content as "new" for anonymous users. Instead I just want to show anonymous users what content has been added recently.


texts: Views to display nodes based on ACL permission

texts:
I'm trying to use Flexiaccess with ACL to build a view based on node that the user has access granted by Flexiaccess.

I found this on Drupal.org, it's the same use case, but is not working for me maybe because is for Drupal 6. (http://drupal.org/node/549412):

    Here's how to do it:

  Under Arguments, create a new argument: "Node: Nid"

  Under "Action to take if argument is not present", select "Provide
  default argument"

  Set the "Default argument type" to "PHP Code", and enter the
  following:

  global $user; return db_result(db_query("SELECT
  GROUP_CONCAT(CAST(an.nid AS CHAR) SEPARATOR ',') FROM {acl_user} au
  INNER JOIN {acl_node} an ON au.acl_id = an.acl_id WHERE an.grant_view
  = 1 AND au.uid = %d", $user->uid));

  Then check "Allow multiple terms per argument", and click "Update".

I follow those steps but my view shows nothing.

Any help is really appreciated.


texts: Output all instances of a repeating field together

texts:
I have Paragraphs installed and am creating a content-type which has nested Paragraphs - so there is a Paragraph with a Title Field, a Body Field - this is then nested in a another Paragraph, so that I can have several boxes across the page. So far so good - what I want to learn is to output the fields so I can put them in jQuery UI tabs.

In my template I currently have:

{{ content.field_tab_title }}
{{ content.field_body }}

Which outputs:
Title Body Title Body Title Body etc.

What I need is:
Title Title Title Body Body Body

So that I can put all the titles in li's for jQuery UI. I've tried putting

{% for item in items %} {{ content.field_tab_title }} {% endfor %}

But then nothing comes out at all.

UPDATE
Following Kevin's Suggestions, I've started again with my templates and have now got;

in paragraph--tab.html.twig:

{{ content.field_tab_title }}

{{ content.field_body }}

and in field--paragraph--tab.html.twig:

{% for item in items %}

{{ item.content }}

{% endfor %}

but this is still outputting:

Tab Title - 1

Body Copy 1

Tab Title - 2

Body Copy 2

But what I need is:

Tab Title - 1

Tab Title - 2

Body Copy 1

Body Copy 2


texts: Custom Display Modes on a custom entity type

texts:
I have created a custom entity type (without bundles) using the Drupal Console command.
Everything works fine with the out the box stuff. I can configure fields, the order of the form and the order of the output display.

However, it seems impossible to add and new View Modes to my new entity type. I have tried adding a new mode to the "Content" view modes section but I don't have the collapsable details section to be able to enable new view modes.

Is there a setting I have missed in the entity code that will display this?


texts:
I want to send an e-mail to all group administrators when a user joins a group.

Rules and OG come with this functionality out of the box, but unfortunately the default rule is set to only e-mail the group manager. I want to e-mail all of the group administrators for the group.

I've just spent a frustrating few hours trying to get this to work. I can manage to make a variable with the groups members, but then struggle to filter this down. I know I can call og_get_users_by_roles() to get all of the information I need but then struggle to insert that information into a Rules variable.

Some help?


texts:
What hooks are there in the render pipeline in between

(A)
hook_entity_display_build_alter,
hook_entity_view,
hook_ENTITY_TYPE_view,
hook_entity_view_alter,
hook_ENTITY_TYPE_view_alter,

and

(B)
field theme preprocess hooks?

BACKGROUND:

I have a very weird bug that I'm stumped at debugging.

It occurs in my behat tests on Travis (Testy or Precise containers) but not locally or in production.

I have a custom field, on a comment type attached to a node type.
The custom field has its own formatter, which returns a simple #markup render element in some cases, somthing more complex in some cases, and nothing in others.

The failing test cases involve a node with 2 comments on it. The first triggers the formatter to return a #markup element, the second triggers a more complex element.

Locally and in production, all works fine and the #markup gets rendered. On Travis, the #markup is definitely generated by the formatter (I can track it through the (A) hooks above), but it disappears by the time the preprocess hooks are called and so is not displayed.

Something on Travis is going funny in the render pipeline. Being Travis I can't debug it interactively. I have rigged up a drupal_set_message/Behat combo so that I can see when hooks are called and print out variables.

What other hooks are there in the render pipeline before the field preprocess hooks that I should be inspecting? Any other ideas what I should be looking at? Could it be a caching issue of some kind?


texts: Unable to get bootstrap working for IE8 on custom theme

texts:
I'm attempting to get bootstrap to work for a custom theme. It works fine in everything except for IE8.

The page in question has the following content

            Content Here

            Content Here

            Content Here

I understand that IE8 doesn't understand media queries or @import. So I've used html5shiv and respond.js to resolve this.

At the top of my page in the head tag I've included:

I've also included

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

In the head tag. However I can't seem to get it to be responsive in IE8. It only sets it to the style that col-sm-12 contains and does not properly divide into 3 equal columns at full size like it should. I double checked the size of the browser and the resolution to make sure it is meant to trigger.

I have also turned CSS aggregation on.

Is there a step I'm missing?


texts: Render a view exposed filter in a region without exposing it as a block

texts:
I have already 20+ view pages that use exposed filter for filtering out content. What i want is to place the filter in the sidebar and not in the top of the page (different region).

I can exposed the view filters as a block and this will work fine but i have over 20+ view pages and that mean 20+ new blocks, increasing the load for the not dev users.

The better approach will involved using a hook to check the views id and if the match (1-20+ ids i will have) then move the exposed filter to a different region.

Is this possible?


texts: Problem with creating page for the path of page display of a view

texts:
I created a library content type. Its view is library__view; this view has a page display whose path is library, which has a contextual filter on the subject of the books(e.g. math, physics).

I created a page in my theme folder, and renamed it page--library.tpl.php. I also embedded library__view using this line.

views_embed_view('library__view','page');

The problem is that library/math does not show math books (while it works right in the view administrative menu).

What is wrong with this? What is the filename of a view whose path is specified to be in a certain URL (e.g. page--library.tpl.php, library.tpl.php)?


texts: How do I test for node type to print a variable from template.php?

texts:
In Drupal 7, you can use the following in template.php to test for the presence of a node type:

function MYTHEME_preprocess_node(&$variables) {
if ($variables['type'] == 'NODETYPE') {
***CUSTOM CODE****
}

In Drupal 7, you can use the following in template to create a variable which can be printed out in your page.tpl.php file:

function MYTHEME_preprocess_page(&$variables) {
      $variables['greeting'] = 'Custom Greeting';
}

But how do you combine the two, to create a variable inside of template.php (that can be printed in page.tpl.php) which changes according to the node type?

I would have thought the following would work:

    function MYTHEME_preprocess_page(&$variables) {
              if ($variables['type'] == 'NODETYPE') {
  $variables['greeting'] = 'Custom Greeting';
    }
    }

But it doesn't work. Why is this? (Using the same code on MYTHEME_preprocess_node also does not work).

Thanks for any help!


texts: How to display articles based on group combinations of various group types?

texts:
I looked at the group module. Defining permissions based on user and entity memberships would suit my needs very well, but sometimes I would need a combination of various group memberships to define if a user is able to see an article.

Example:

There are two group types: site and department.

The user is a member of the group "Paris" and the department "sales". The article is a member of both groups as well.

The user should only see articles which are member of BOTH groups. He should not see the articles which are member of the group "Paris", but not member of the group "sales".

Is this possible?


texts: Uncaught exception thrown after moving my website to localhost

texts:
My website works right on server, I took a backup from database and public_html in order to have a copy of my webstie in localhost.

I imported the database but it reported an error, some thing was wrong with content of  cache_views table, so I emptied this table and database successfully imported. I replaced public_html with the old one and configured settings.php. but it doesn't work, it reports this error :

Additional uncaught exception thrown while handling exception.

Original

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = &#039;default&#039;; Array ( [:language] =&gt; fa [:source] =&gt; Makes the view results available as a context for use in Panels and other applications. [:context] =&gt; ) in locale() (line 684 of C:\xampp\htdocs\test\modules\locale\locale.module).

Additional:

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) 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, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] =&gt; 0 [:db_insert_placeholder_1] =&gt; php [:db_insert_placeholder_2] =&gt; %type: !message in %function (line %line of %file). [:db_insert_placeholder_3] =&gt; a:6:{s:5:&quot;%type&quot;;s:12:&quot;PDOException&quot;;s:8:&quot;!message&quot;;s:455:&quot;SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = &amp;#039;default&amp;#039;; Array ( [:language] =&amp;gt; fa [:source] =&amp;gt; Makes the view results available as a context for use in Panels and other applications. [:context] =&amp;gt; ) &quot;;s:9:&quot;%function&quot;;s:8:&quot;locale()&quot;;s:5:&quot;%file&quot;;s:52:&quot;C:\xampp\htdocs\test\modules\locale\locale.module&quot;;s:5:&quot;%line&quot;;i:684;s:14:&quot;severity_level&quot;;i:3;} [:db_insert_placeholder_4] =&gt; 3 [:db_insert_placeholder_5] =&gt; [:db_insert_placeholder_6] =&gt; h t t p://localhost:81/test/ [:db_insert_placeholder_7] =&gt; [:db_insert_placeholder_8] =&gt; 127.0.0.1 [:db_insert_placeholder_9] =&gt; 1389935326 ) in dblog_watchdog() (line 154 of C:\xampp\htdocs\test\modules\dblog\dblog.module).


texts:
I am looking for a module or way to use an external RSS feed in a view. I know this was easily done in Drupal 6, but I can't seem to find much on Drupal 7.

I am trying to use Views RSS, but there is very limited documentation.


texts: How can I show poll options and hide vote button for anonymous users in advanced poll module?

texts:
I am using Advanced poll module to create polls in Drupal 7.

I want to show poll options and vote button to authenticated users, but I want to show poll options and a message instead of vote button to anonymous users.

I've achieved this by editing the advanced poll module, however I am scared of losing changes on core update.

Is there any hook or method to achieve this without editing core files?


texts: Templates aren't called in custom module?

texts:
I am trying to add templates for the paragraph in the custom module. It invokes only the paragraph.html.twig.

In theme suggestion, paragraph--example-ch-hero-panel.html.twig is given. I am using the same templates. By default, The template will be taken for the paragraph here. But here its not working. I am not using hook_theme in .module for this. because I am not passing any values to the templates.

even try this also

function example_ch_hero_panel_theme() {
  return [
    'paragraph__example_ch_hero_panel' => [
      'render element' => 'element',
      'template' => 'paragraph--example-ch-hero-panel',
      'base hook' => 'paragraph',
    ],
  ];
}

added theme registry too

function example_ch_hero_panel_theme_registry_alter(&$theme_registry) {
  $theme_registry['page']['path'] = drupal_get_path('module', 'example_ch_hero_panel') . '/templates';
}

  Please try again later.Twig\Error\LoaderError: Template
  "modules/custom/example_ch_hero_panel/templates/page.html.twig"
  is not defined. in Twig\Loader\ChainLoader->getCacheKey()

can anyone sort out this issue.


texts: How to create a combination chart with the Charts module if some X-axis values are missing?

texts:
I've been searching for a solution to my problem for a while without success so maybe someone here can help me.

I've already looked at the answer to the question about "How to combine 3 line charts in a single chart, using the Views integration of the Charts module?", but that didn't help to solve my issue.

I use the Charts module to create a chart in Views using the "Chart" display format. And I'm using Highcharts as my charting library to draw the number of "Passed" nodes (in green). I also created a chart add-on to represent the number of "Failed" nodes (in red) so that I can have multiple series in the same chart.

At this moment this is the chart that I have with the problem I will describe below:

As you can see in the table above, I have 4 different dates (Run Date and Time). The chart should show the 4 dates. Instead, it only shows 3 dates and this is why: The last date doesn't have "Passed" nodes, so the chart display (the parent) does not have that value on its axis. The chart add-on, representing the 2 Faileds on the last date, is then represented on top of the first display using the 3rd date and not the 4th, giving the error.

It seems that the x-axis values are irrelevant in this module.

The chart that I want should be something like this:

I made this chart in Excel and the difference that I see (that is giving me the wrong results in Drupal) is that I don't have a "0 Passed" or "0 Failed" but instead I have no results at all.

Is there a way to get this working correctly? I tried already many charts modules available and everyone has this problem as far as I know ...

Below is also a screenprint of my view:

Note: for the table below the chart I'm using module Views Merge Rows and it's clear that the top two dates don't show the "0 Failed" or "0 Passed" (as shown in the tabular display of my first screenprint) needed to have a correct chart displayed.

EDIT: I have found the same issue here and here. Hope it helps.

If there's need to have a solution like in the second link, i.e., construct the view in a way that both series will always have all labels, I'm open to it.


texts:
I'm quite new in Drupal and I have to create a register form with dropdown lists like (Country->Province->City) but I can not use javascript, jquery or ajax due to accessibility issues. Is there any way to create it?

Some tips are welcome!


texts: Get field definitions across bundles, including base fields

texts:
In Drupal 8 there are two types of fields: "base fields" like node.uid, and user-defined fields like 'node.body'.

All of the field names for one entity type can be found with EntityFieldManagerInterface->getFieldMap(). However this only contains the field type (as string) and a list of bundles.

For the base fields like 'uid', there is EntityFieldManagerInterface->getbaseFieldDefinitions($entity_type_id). But this omits the user-defined fields.

For user-defined fields, there is EntityTypeManagerInterface->getStorage('field_storage_config')->load($entity_type_id . $field_name);. But this does not include base fields like 'node.uid'.

There is also EntityFieldManagerInterface->getFieldDefinitions($entity_type_id, $bundle_name). But this has to be called per bundle.

There is more in FieldTypePluginmanager, EntityAdapter, and EntityDataDefinition. The more I look, the more confusing and complex this entire architecture looks to me..

Background

I would like to show a select element where a user can choose a field.
Entity type is given, but bundle is not.
Options are filtered by various criteria. E.g. maybe I want to show all fields where the item type extends EntityReferenceItem, and the reference target type is 'node'.
For this I need to inspect the definition of each field.

All of this is for D8 version of https://drupal.org/project/renderkit.


texts:
I'm running Drupal 8.8.x

The Problem

Entity is not being saved when form is submitted through AJAX. Example:

Build Form

public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity = NULL) {
  if($entity) {
    $this->entity = $entity;

    $form['element'] = [
      '#type' => 'textfield',
      '#title' => $this->t('My title'),
      '#name' => 'element',
      '#ajax' => [
         'event' => 'focusout',
         'callback' => [$this, 'myCallback'],
         'disable-refocus' => TRUE
      ]
    ];
  }

  return $form;
}

Submit Form

public function submitForm(array &$form, FormStateInterface $form_state) {
 $element = $form_state->getTriggeringElement()['#name'];
 $value = $form_state->getValue($element);

 $this->entity->set($element, $value);
 $this->entity->save();
}

I've confirmed $element and $value are the correct key and value. However, when I save the entity nothing happens. There is nothing updated in the database. And there are no errors emitted in the console or watchdog.

If anyone knows what could be the issue I'd appreciate some insight! :)


texts:
I use Feeds so that logged users can upload data. I need to keep track of which user uploads what.

In Feeds importer 'Settings' you define the author, but in my case it should not be static but defined dynamically by the system.

How can I dynamically change that? thanks


texts: Query Drupal User Table for: date created < $today - '100000'

texts:
I would like to select users from the Drupal users table where the date created was older than 1 day ago. Then delete those users. This code isn't correct but it will give you an idea of what I am trying to do I just don't know the right DB query. '

$users = db_select('user', 'created') //I know this is not the right DB query
$count = count($users);
if($count > 0){
  $users = user_load_multiple(array_keys($users['user']));
}
$today = getdate();
if ($users < $today - '100000' ) {
 user_delete($user->uid)
}

I am thinking about using user_load_multiple() to load the users in to an array to perform the delete action.


texts: I am using zaptech theme in Drupal 6 while I am upgrading existing site to Drupal 7 it give me the error: Undefined variable: node in include() ,themes\zaptech\page.tpl.php can anyone tell what the solution for the node object


texts: Can't update LDAP module due to Memory Limit

texts:
I need to update the LDAP module from 7.1.x to 7.2.x to remove a fatal error. When I navigate to the update.php script, there are 18 updates. When I run the script I get this error:

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: https://www-dev.site.com/mysite/update.php?op=selection&token=Ct2z9U8FEbzMqkjyvubbvaL_WxETSh-8xy_r7FqAzgE&id=5164&op=do
StatusText: OK ResponseText: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 523800 bytes) in
/var/www/webaccounts/mysite/public_html/sites/all/modules/ldap/ldap_servers/ldap_servers.install on line 290

It started at 128 mb, then I increased it in double increments to try and solve the problem but there is no change, even at 1024 mb. This doesn't seem to be a memory issue. What is causing the problem?


texts: nodes exist in database and "page not found" - drupal6

texts:
I have a drupal6 site and have a content type "resource" with more than 500 nodes.
there are some nodes "almost 15 nodes" from this type of "resource" when open it tell me "page not found", also when edit it tell "page not found" and when delete, set message "success deleted " and not deleted

although, theses nodes exist in "Data Base" in "node" table
and when try function "node_load(nid)", didn't work.

i tried search for 2 days and tried many many solutions and still couldn't reach to solution.

i hope if there is who help me
Thanks


texts:
I am trying to create a new twig template that defines different types of views templates - or some sort of option based format.

Example 1:

Generic view blocks: block--views-block.html.twig

Example 2:

News Block specific views with no container: block--views-block--news-elements-block-1.html.twig

Example 3:

List Block specific views with no container: block--views-block--list-elements-block-1.html.twig

What i want to achieve: - if i can present an option on the block, that would also work.

Views block with no container: block--views--no-container--block.html.twig

So far:

function THEME_theme_suggestions_alter(array &$suggestions, array $variables) {

  // dpm($variables);

  // $content = $variables['elements']['content'];
  // if (isset($content['#block_content']) && $content['#block_content'] instanceof \Drupal\block_content\BlockContentInterface) {
  //   $suggestions[] = 'block__' . $content['#block_content']->bundle();
  // }
}


texts: Import multiple node reference from CSV using feeds

texts:
I am trying to import multiple node references for one node using feeds. How should my CSV look like for that??

Will this work :

"title","description","status","code","details",("contact1","contact2", ..., "contactN" );

given that I have another content type named contact with titles contact1, contact2, ..., to contactN


texts: How to disable error messages to screen while mysql service is down

texts:
Our production environment got a problem and the mysql service was down. The all our drupal based sites show the error messages below which expose to many information.

  PDOException: SQLSTATE[HY000] [2002] Can't connect to local MySQL
  server through socket '/var/run/mysqld/mysqld.sock' (2) in
  lock_may_be_available() (line 164 of
  /home/workspace/drupal7/includes/lock.inc).

I find this page (via) about how to disable drupal errors, but have no effect when mysql is down.

Any one can give me a hand?


texts: Is it possible to use civicrm stand alone profile page to edit existing contacts? Is it also possible to alter or override civicrm stand alone profile page via Drupal hook apis?


texts:
I am new to drupal and using drupal 7. I have created some taxonomies and using it as menus using Taxonomy Menu module. The Taxonomies are being shown as menus.

Now I want to change content of the page as per term of the taxonomy. I have searched the problem but found different modules doing this task like Taxonomy Display, Taxonomy Menu Block. But I don't want  to use any of the module and want to do it manually so that I can understand the inner working of Drupal themes.

Any help will be much appreciated.


texts:
I created a field for taxonomy terms called "Category Image". I am overriding the taxonomy term pages /taxonomy/term/% using views. The only way to add the "Category Image" on top of a page is to add the relationship Content: Taxonomy terms on node so I can have the category image field that I produce excluded from display and rewrite it on the header.

The problem with this solution is that I have multiple duplicates on my term page's nodes.

Any solution is appreciated.


texts:
How can I load recent nodes with node_load()?

I used the following code, but I can't edit the links because it creates a list where they are inside it. I want to load the node IDs, and then use node_load() to load each node.

$output = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = '%s' AND n.status = 1 ORDER BY n.created DESC"), story, 0, 10));
print $output;

How is that possible?


texts: It is possible to have an action for the condition rules?

texts: I have several conditions that are called in rules_condition_info () and wanted to have an action for each, for whenever a function returns true, it is called an action. I know it's probably possible, but how do I tell the action you want to perform a certain action for a certain condition ... thanks


texts: Dynamically producing content type fields from a drop down menu

texts:
I have a content type called payment schedule that has a payment amount and payment date.

When creating a payment schedule, it should say something like Number of payments to make and let me choose a value (the number of payments) from a drop down menu. For example, I could choose 1, 2, 12, 16, right up to 24.

Based on the number  it should generate an amount box and a payment date box. This means, if I choose 24 it gives me 24 x 2 boxes - one for the amount and one for the date. If I choose 6 - it would give me 12 - 6 for the amount and 6 for the payment date.

What's the best way to go about this? if there's a module that can do this or writing my own or looking at something like rules or ajax, or can it be done in views


texts: How to link to a users profile in a view

texts:
I created a view which displays users on my site. Using "Rewrite results" I displayed the first name and Surname in one column. I then checked "Output this field as a link".

My challenge is what path will I enter into the "Link Path" field to ensure that the names in the column link to the user profiles.


texts:
I have a content type with a taxonomy field on it that needs to be included in the standard search of Drupal 7.

Is there a way to do this or do I have to set up a view to override the standard search?

If I do have to use a view, how can I set it up to allow searching all fields on a node from one text field in the search form?

I thought Drupal did this with it standard search but it doesn't seem to.


texts:
I am developing a site (Drupal 7, Omega sub-theme, panels & views). On every product page I have a link to the webform. I need the webform to register to which page the customer is referring. In other words, where is the link coming from, or what is URL of the last visited page?
Is there a specific drupal way of doing this?
Or any other way, for that matter?
Thanks!


texts: How can I customize the header and footer from a custom page controller?

texts:
I have a module named some_module.

This is my some_module.routing.yml:

some_module.index:
 path: '/this/is/the/path'
 defaults:
   _title: 'Some Title'
   _controller: '\Drupal\some_module\Controller\SomeController::index'
 requirements:
   _permission: 'access content'

This is my SomeController.php:

namespace Drupal\some_module\Controller;

use Drupal\Core\Controller\ControllerBase;

class SomeController extends ControllerBase {
    public function index()
    {
        return [
            '#theme' => 'some_template',
          ];
    }

When I go to /this/is/the/path in my browser. It's showing my theme's header and footer. How can I customize header and footer when I access /this/is/the/path?


texts:
I just migrated the site from sqlite to Postgres, using the drush portabledb-import module

I'm getting a error page only when no user is logged in to the site.

I can get logged in using the login-link generated running

drush user-login

and everything works great, all the content is there and accessible, views all work, etc...
however log out and I get this message at the home page again

The website encountered an unexpected error. Please try again later.

and The watchdog-show reports this

 ID         :  8
 Date       :  12/Mar 13:07
 Type       :  php
 Severity   :  error
 Message    :  PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for integer: "not yet assigned"
               LINE 4: WHERE  (base.uid IN  ('not yet assigned'))
                                             ^: SELECT base.uid AS uid, base.name AS name, base.pass AS pass, base.mail AS mail, base.theme AS theme, base.signature AS signature, base.signature_format AS signature_format, base.created AS created, base.access AS access, base.login AS login, base.status AS status, base.timezone AS timezone, base.language AS language, base.picture AS picture, base.init AS init, base.data AS data, base.uuid AS uuid
               FROM
               {users} base
               WHERE  (base.uid IN  (:db_condition_placeholder_0)) ; Array
               (
                   [:db_condition_placeholder_0] => not yet assigned
               )
                in DrupalDefaultEntityController->load() (line 191 of/usr/local/www/main/includes/entity.inc).

I've checked the DB and the 0 uid looks fine
but just in case I followed the "Restore the anonymous (user ID 0) user record docs located here
https://drupal.org/node/1029506

any ideas or suggestions would be greatly appreciated.


texts: How to access protected property in feed object?

texts:
When I try to access protected property in feed object I am getting error (Error: Cannot access protected property Drupal\feeds\State::$messages)

Feed Object:

Anybody know How to get protected property(messages) from object?


texts: How add sorting by Flag counter in Controller?

texts:
I get node list in my Conroller:

$query = \Drupal::entityQuery('node')
  ->condition('status', 1)
  ->pager(10)
  ->sort('created' , 'DESC');
$nids = $query->execute();

How can add sorting by Flag counter?


texts: Creating an iframe playlist that loops through urls (from a node field)

texts:
Scenario

A content type called "Playlist" exists. Playlist has a text field: field_playlist_sources. When a user creates the Playlist they can add multiple values for field_playlist_sources. Each value is a url like: http://somesite.com.

When the Playlist node is viewed, the field_playlist_sources field is displayed with a Custom Formatter (using the Custom Formatters module). The format for the display of this field is:

<iframe src="" name="frame" id="frame" width="100%" height="1080px" seamless frameborder="0" scrolling="no"></iframe>

Notice the empty src.

What I'd like to do is loop through the values provided for field_playlist_sources within the iframe.

With Javascript this would look like this:

var frameSRC = Array(
  'http://someurl.com', 60,
  'http://anotherurl.com', 60);
var i = 0, len = frameSRC.length;

function ChangeSrc() {
  if (i >= len) { i = 0; } // start over
  document.getElementById('frame').src = frameSRC[i++];
  setTimeout('ChangeSrc()', (frameSRC[i++]*1000));
}

window.onload = ChangeSrc;

As of right now, I'm not sure how to bring in the values from the field to this javascript file. Maybe there is a better approach?

Any help would be greatly appreciated.


texts:
I'd like to switch theme per user upon user login success in my drupal 6 site. I need to check username of a particular user to change a particular theme for that user.
Is there any module around to accomplish this?
Or, do I have to write a hook like

function mymodule_init(){
    global $custom_theme;
    global $user;
    // check username here.
    $custom_theme = 'garland';
}

But, I'm finding a module which have admin interface so that I can define usernames as much as I can.


texts: How to add the paragraph parent field in the theme suggestions alter

texts:
I've been spending a couple of hours from debugging the paragraph properties using kint and var_dumper however, the page is freezing and I'm unable to see what are the properties and methods available. Has anyone tried to add a hook theme suggestion to paragraph based on its parent field name?

I have added a paragraph type as well as added the fields, then I created a node and paragraph reference.

Here's a sample code:-

function THEMENAME_theme_suggestions_paragraph_alter(&$suggestions, $variables) {
    $paragraph = $variables['elements']['#paragraph'];
    $parent = $paragraph->getParentEntity();

    $suggestions[] = 'paragraph__' . $parent->bundle() . '__' .  $paragraph->bundle();

    // get the parent field of the current paragraph
    // assuming that the parent field name is field_test_paragraph
    $parent_field_name = 'field_test_paragraph';

    // field_test_paragraph should be added to theme suggestions
    $suggestions[] = 'paragraph__' . $parent->bundle() . __ . $parent_field_name . '__' .  $paragraph->bundle();
}

Expected output:

paragraph--nodetype--field-test-paragraph--paragraph-type-name.html.twig


texts: How can I display lots of rows of information from a database in my drupal module?

texts:
In the example_page I believe it shows something like this:

function foo() {
    return array('#markup' => t('bar'));
}

And the function foo would be used for a page callback in the menu hook to create a page. However, In my module I plan on using a db_query to access a database table and with it display many rows of data.

Is there a better way to do this than stuffing all of my output into #markup? It could be done with lots of concatenation, but it would be rather messy and it seems like there should be a better way.


texts: Is there a way to remember the chosen product attribute on the add to cart form? I have a product with a couple of options. If the users selects one on the product page and goes to another page, the form will reset and selects the first option again.