texts:
I have a theme, and for the life of me can't figure out why $content is rendering "array". I have switched to two other themes (framework and seven, and my new theme is based off of the framework theme that is working).

Here is an example of the theme code:

    <div <?php if ($left): ?>id="maincolright" <?php elseif ($right): ?>id="maincolleft" <?php else: ?>id="main" <?php endif; ?>class="nobg node-<?php print $node->nid; ?>">

    <?php if ($tabs): print '

'. $tabs .'
'; endif; ?>
    <?php if ($tabs2): print '
'. $tabs2 .'
'; endif; ?>
    <?php if ($tabs): print '
'; endif; ?>
    <?php if ($show_messages && $messages): print $messages; endif; ?>
    <?php print $help; ?>
    <?php print $content; ?>

So $content is there, and it should be fine, but on any pages I view, for instance, the page render, the edit page, or even my devel page, show only 'array'. See the screenshot:

Has anyone come across this?


texts: Setting up subdomains, confused on "Settings.php" / "web.config" setup

texts:
First, I'm using shared hosting.  I've set up the DNS so I have one.example.com, two.example.com, etc.  Each subdomain works properly, but they use the default page.tpl.php/look exactly the same as my front page.  I'm assuming the next step is to configure the settings.php, web.config, and to create preprocessed theme hooks.  Is there a good D7 tutorial on how to do all of this via "subdomains"?

Also, I'm planning on using the "Domain" module.  I've got it properly configured.  But, don't really see a point in using it until the above mentioned is setup properly.


texts: Is the ckeditor or other editor supposed to be automatically installed?

texts:
In a fresh install of Drupal 7, when you create and article or page, is there supposed to be an editor?  When I create an article or page, it's just the text area where you type in the content.  There is no editor so I can bold, upload an image, justify, etc.

Did I do something wrong?

admin/config/text formats, Full html, Administrator; I am the administrator.


texts: How can I add extra data to a file field?

texts:
I am using Drupal 7's core module, file.

The file field array looks like this:

[field_game] => Array
    (
        [und] => Array
            (
                [0] => Array
                    (
                        [fid] => 57
                        [display] => 1
                        [description] => the-pyro-guy.swf
                        [uid] => 0
                        [filename] => the-pyro-guy.swf
                        [uri] => public://swf/the-pyro-guy_2.swf
                        [filemime] => application/x-shockwave-flash
                        [filesize] => 5506729
                        [status] => 1
                        [timestamp] => 1346017444
                        [rdf_mapping] => Array
                            (
                            )
                    )
            )
    )

In addition to the above data, I want to store keys containing the game's height and width in this same file field. Can I do this, preferably in code?


texts:
I have been having an issue with drupal's text editor. I am making a custom block for FAQ section of my website but whenever I try to html code containing certain words inside  such as 'from' etc. it reload on itself and rejects my code. I know it sounds strange but I have tried everything and narrowed down the issue to this.  for example the text editor reject this code:

<p> from </p>

but it accepts this code:

<p> sample </p>

I updated core Drupal, but still this error occurs. Is there any fix for this? ("Full HTML" option is selected) or is there anything wrong with my editor?


texts: What is the exact preprocess hook for this node--content_type.tpl.php?

texts:
I've everything and two themes to get node.tpl.php and node--content_type.tpl.php and nothing is working. I tried adding a preprocess hook in template.php but nothing is working. I've tried scouring D.o. and here and see similar problems but none of the answers solve my issue.

I've tried skeletontheme and zircon and neither one is giving me anything back. In skeleton, they have themes/skeletontheme/templates/node.tpl.php but altering this file in any way does absolutely nothing. I think they may have included it without needing it and never worried about it. But it does nothing out of the box. I added a preprocess hook in their template.php file and it still does nothing. So I think I'm just using the wrong preprocess.

Zircon has themes/zircon/tpl/page.tpl.php but no node.tpl. So I added one and the content_type.tpl and nothing. So I added a preprocess hook there but still nothing.

page.tpl.php works on both just fine.

1) I've made sure the preprocess has the correct them name like zircon_preprocess

2) I've made sure my machine name on the content type is correct and it is

3) The skeletontheme node.tpl.php looks like it works on none CCK created content types. I.e. blogs, articles, and the front page. But on any CCK created content-types it doesn't work. I've scoured the template.php and the node.tpl to look for IF statements that might be excluding anything. No luck.

4) I've never actually gotten node.tpl.php or node--content_type.tpl.php working since I was mostly using distribution packages before and they were already included and I just customized them. I've even gone back and look through their templates.php and I can't find anything.

So can I have a step-by-step (other than the one on D.o that I can't get working) for getting node.tpl.php and node--content_type.tpl.php working from the beginning as if you were creating a theme from scratch?


texts: Want to use exposed filters to pass arguments to a view

texts:
The title explains a lot.

I have a view which shows everything of the content type and has exposed filters.(<-main view)

Now I made another view where I used the exposed form style because I want it to act as a "search block". It shares the same filters as the main view and I want this to pass its arguments to the main one.

For example: A user is on the main page, fills in the filters, submits-> Redirects to the main view where the filters the user filled in are now being used.

I looked for a lot of solutions but couldnt find any.
Thanks in advance!


texts:
I am trying the user account form(the one that comes in user/%/edit) of the logged in user, I have tried:

drupal_get_form('user_profile_form');

&

drupal_get_form('user_profile_form',1);

Though the form is loaded, on calling render() the div is empty.


texts: Truncate field storage tables added by module before uninstall

texts:
I've added a field via hook_entity_base_field_info(). It has data stored in it. I then go to uninstall my module and I get the following error:

-> drush8 pm-uninstall massing -y
The following extensions will be uninstalled: massing
Do you really want to continue? (y/n): y
exception 'Drupal\Core\Extension\ModuleUninstallValidatorException' with message 'The following reasons prevents the modules from being uninstalled:    [error]
There is data for the field massing_memberships on entity type User' in
/Users/les.peabody/Sites/drupal8/core/lib/Drupal/Core/Extension/ModuleInstaller.php:347
Stack trace:
#0 /Users/les.peabody/Sites/drupal8/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(95):
Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
#1 /Users/les.peabody/opt/drush8/commands/core/drupal/environment.inc(227): Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
#2 /Users/les.peabody/opt/drush8/commands/core/drupal/pm_8.inc(80): drush_module_uninstall(Array)
#3 /Users/les.peabody/opt/drush8/commands/pm/pm.drush.inc(1190): _drush_pm_uninstall(Array)
#4 [internal function]: drush_pm_uninstall('massing')
#5 /Users/les.peabody/opt/drush8/includes/command.inc(364): call_user_func_array('drush_pm_uninst...', Array)
#6 /Users/les.peabody/opt/drush8/includes/command.inc(215): _drush_invoke_hooks(Array, Array)
#7 [internal function]: drush_command('massing')
#8 /Users/les.peabody/opt/drush8/includes/command.inc(183): call_user_func_array('drush_command', Array)
#9 /Users/les.peabody/opt/drush8/lib/Drush/Boot/BaseBoot.php(62): drush_dispatch(Array)
#10 /Users/les.peabody/opt/drush8/drush.php(70): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#11 /Users/les.peabody/opt/drush8/drush.php(11): drush_main()
#12 {main}

So what I'm trying to figure out how to do is how to drop the data in this table after I've called for an uninstall on the module, but before the check happens for whether or not there is data in the table. I've tried implementing hook_uninstall() and hook_module_preuninstall() but neither of these hooks are invoked before the check for data presence. Thoughts?

EDIT: Looking at ModuleInstaller.php at line 343 (D8 RC1), it runs uninstall validators prior to triggering hook_module_preuninstall and hook_uninstall. This is where it is failing. So, maybe there is a way to add an uninstall validator for my module and run it first? There doesn't look to be any other way to do it besides adding some kind of mechanism to the module which makes it "purge" itself of any data it's added to the system, which then lets you uninstall it. Seems terribly convoluted and not side builder friendly in the slightest, very frustrating.


texts: I am looking for help trying to make a views to list users with an associated location

texts:
I am struggling trying to create my view.

I am looking to automatically create a list of users who have selected a location in their profile (using location module cck field). I want to display this information in a block on a page where I have information on that location.

I am allowing them to select either a country or a country and a city.

In my View I am using:

field: User Name

Filter: User Active

Relationship: Profile

And then I cannot figure out what I need to put for the contextual filter. I have tons of locations so I need something that will automate the process.

Thank you for your help.


texts: Programmatically load the uid of the owner of a viewed profile2 entity

texts:
Using Display Suite together with Profile2 and Flags. I want one of my flags to be visible on the profile2 page, but only to the owner of the profile page and to the administrator.
I try adding a code field with Display Suite. I can get the field to display, I can get it to display to only administrators, but I don't find a way to allow only owner and administrator to view the flag.
What I need is the uid of the user viewing a profile (I've got that one), and then I need the uid of the owner of the profile being viewed, and compare them.
The profile2.module source has the following lines:

$account = isset($account) ? $account : $GLOBALS['user'];

    if ($account->uid != $profile->uid) {

      do something here.

    }

That looks like it is what I need, but I don't seem to be able to implement it. Any help would be appreciated.


texts: How to get a node content programmatically?

texts: I am writing a module, in which I am required to display contents from multiple nodes. Using the configs I save, I will get the node id's in hook_block_view. Using that is there a way to get the contents of the particular node, so that I can manipulate on that?


texts: Update field data added in user form using a hook?

texts:
I've added three fields in user form.

User code
User name
User ID.

I want to add this field data into the database. My question is, in which hook, i should write the logic of manipulating and saving data.


texts: Send site emails to multiple administrators

texts:
Simple question, though I cannot find the answer anywhere --

How does one specify multiple addresses for the primary administrator account in Drupal 7?

Put another way -- how does one make Drupal administrator emails go to multiple people, without setting up a bunch of forwarding filters on the mailserver?

Thanks!


texts:
In drupal I'm displaying a view in a block. I'm stripping out all the html and rewriting the results as this

[field_button_image]

On the preview it looks okay, but in the block that contains the view it renders the image like this

The image is distorted because of the width and height styling that is added in the tag. Where is this coming from? And is it possible to disable it?


texts: Get value from field outside field collection

texts:
I have the following setup:

Field price (boolean)
Field collection

Field amount (decimal)
Field total (computed)

How can I load the "price" field inside the "total" computed field to calculate with it? When I use my normal code in the total computed field nothing happened, probably because I want to load a field from outside the collection? Anyone has an idea how to achieve this?

 $price = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_price')));


texts: Disable caching (for theme develoment) doesn't work

texts:
I'm quite desperate. I have disabled it in the admin backend (Administration -> Configuration -> Development -> "Page cache maximum age" = "<no caching>"). In sites/default/services.yml I have:

parameters:
  twig.config:
    debug: true
    auto_reload: true
    cache: false

I even tried to disable the opcache (wich makes not much sense, of course). The templates get translated (or rendered?) only once after I manually clear the cache.

I'm using Drupal 8.3.4, PHP 7.1 with php-fpm, postgresql and lighttpd on CentOS.

To always clear the cache – by clicking in the interface or drush cr –
feels like compiling a c++ application. And doing a delete from cache_render; delete from cache_dynamic_page_cache; delete from cache_entity; in the psql console feels 500 times faster but also isn't really convenient.


texts: How not render a region on specific page programmatically on Drupal 8

texts:
I put a custom block (develop for me) on sidebar first region for every page, every fine, but I want that this block not render on the home page.

On my module, I made this:

funtion mymodule_preprocess_page(&$variables) {
  if ($variables['is_front']) {
    unset($variables['page']['sidebar_first']);
  }
}

The sidebar not show, but the block already was rendered (I debug this code and the build function of my block was called before of mymodule_preprocess_page function). Then how I programmatically avoid that this block not render.


texts: content administration page not found, and user manager page not found

texts:
I don't know what did this...but now when I try and go to my content manager or my user manager I get a 'page not found' in the admin overlay.

.htaccess is ok and nothing has changed in the php.ini

Where do I look next?

also to note:  admin/people/people is giving me Permission denied?!   I am UID 1 obviously...

updated:  the add content button is still there..  so im guessing this is some broken core module?  I have tried replacing the core and it still is giving me the same thing.
attached is a screeen


texts: Rest full web service API url is changed in d8

texts:
I have rest service url for a node in d6  as

https://192.168.1.236/rest_endpoint/node/1140.json

but the same url in drupal 8 is not working at all , for d8 i have  to give

https://192.168.1.236/rest_endpoint/node/1140?_format=json

here 1140 is the node id and 192.168.1.236 is the base url .

As the url is changing i have to modify many scripts .What may be the reason for this ? or is there any workarounds ?


texts: How do you make a Image View of a specific page?

texts:
I have a problem.
The thing is that I know that you can have a [Content Type] with an image [Field], and then you can create a [View] to display the image [Field] in each of the pages that are of the selected [Content Type].
However, (if I have a [Content Type] that is an image gallery), how can I create a view that only displays the gallery of one specific page? I mean, just one entry of a [Content Type].
For example, a services_list page of basic_page [Content Type].
The end goal I want to reach is a Slideshow of a gallery, and clicking that slideshow must send me to a specific page.
So if it was possible to assign a specific link to a slideshow, instead of using the option [Link to: Content] that would work too.


texts: Multilingual views hide if no translation

texts:
My Drupal website has 2 languages and I created blog view that lists articles (content type). Default language is English.

Problem is that some articles are only in German and then on my English view I get German articles.

I tried adding Content: Translation language Filter that I set to Interface text language selected for page but then on German page I only get articles that were created on German and the ones that were created in English but have German translation are missing.

Query :

SELECT node_field_data.created AS node_field_data_created,
node_field_data.nid AS nid
FROM
{node_field_data} node_field_data
LEFT JOIN {node__field_content_type} node__field_content_type ON
node_field_data.nid = node__field_content_type.entity_id AND
(node__field_content_type.deleted = '0' AND
node__field_content_type.langcode = node_field_data.langcode)
WHERE (( (node_field_data.status = '1') AND (node_field_data.type IN
('article')) AND (node__field_content_type.field_content_type_value = '1')
))
ORDER BY node_field_data_created DESC
LIMIT 5 OFFSET 0

Query with Translation language filter:

SELECT node_field_data.created AS node_field_data_created,
node_field_data.nid AS nid
FROM
{node_field_data} node_field_data
LEFT JOIN {node__field_content_type} node__field_content_type ON
node_field_data.nid = node__field_content_type.entity_id AND
(node__field_content_type.deleted = '0' AND
node__field_content_type.langcode = node_field_data.langcode)
LEFT JOIN {node__field_tags} node__field_tags ON node_field_data.nid =
node__field_tags.entity_id AND node__field_tags.field_tags_target_id = '4'
WHERE (( (node__field_tags.field_tags_target_id IS NULL) )AND((
(node_field_data.status = '1') AND (node_field_data.type IN  ('article'))
AND (node__field_content_type.field_content_type_value = '1') AND
(node_field_data.langcode IN  ('en')) )))
ORDER BY node_field_data_created DESC
LIMIT 5 OFFSET 0

From queries, I see that LEFT JOIN is adding node__field_content_type.langcode = node_field_data.langcode and I think that is making problems when I add the language filter, any suggestion?


texts: How to translate variable containing html with the i18n_variable module?

texts:
I am trying to translate a variable with i18n_variable module. I am using the following code:

/**
 * Implements hook_variable_info().
 */
function MY_MODULE_variable_info($options) {
  $variables['pm_email_notify_subject'] = array(
    'title' => t('My variable title'),
    'description' => t('The description', array(), $options),
    'default' => t('A good default value', array(), $options),
    'type' => 'string',
    'localize' => TRUE,
    'access' => 'administer checkout',
    'group' => 'my_variable_group',
  );
  return $variables;
}

This works as expected: I can choose the variable to be translated at /admin/config/regional/i18n/variable and when I do so, I can find its value via /admin/config/regional/translate.

But the problem is, that the variable contains HTML markup and although this works with the original content, the markup in the translated string gets converted to HTML entities. what am I missing?


texts: How do I know what setSetting is suppose to be?

texts:
I am creating a custom content entity and in the BaseFieldDefinitions, I am trying to create a field for assigning a user as the designated assigner and will follow up with a assignee. So far, the code has been pretty easy to follow and makes sense, except for setSetting.

Basically the field below works, but its copy and pasted from drupal console as boiler plate code. What I don't understand is the setSetting part. If I comment out ->setSetting('target_type', 'user'), the field displays but no longer works.

So my question is, how am I suppose to know, or figure out, that I should be typing in 'target_type' and value 'user'? I went through the API but haven't managed to find any references to this. And I don't understand the setSetting below it either, 'handler' = 'default. I can comment that out and it works fine. So what gives?

How am I suppose to know what to set in the setSettings part? As I also noticed, not every field definition even has this.

$fields['assigner'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Assigner'))
  ->setDescription('The person who will issue this Task.')
  ->setRevisionable(TRUE)
  ->setSetting('target_type', 'user')
  ->setSetting('handler', 'default')
  ->setTranslatable(TRUE)
  ->setDisplayOptions('view', [
      'label' => 'hidden',
      'type' => 'author',
      'weight' => 0,
  ])
  ->setDisplayOptions('form', [
      'type' => 'entity_reference_autocomplete',
      'weight' => 5,
      'settings' => [
          'match_operator' => 'CONTAINS',
          'size' => '60',
          'autocomplete_type' => 'tags',
          'placeholder' => '',
      ],
  ])
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);


texts: Overcoming 255 character URI limit for files_managed

texts:
I recently stumbled upon an interesting limitation of Drupal. It seems that in the table files_managed there is a field called "uri" which represents the path to the files being managed by Drupal. This field is defined as a VARCHAR(255). I was blissfully ignorant of this fact/limitation until one of our users initiated a chain of events that lead to Drupal trying to manage a file with a 261 character path, at this point Drupal gave a nasty database error which lead me to this issue.

Is there anyway to configure Drupal to allow file paths longer then 255 characters?


texts: List publications by same Author on Staff page

texts:
I'm using the biblio module to manage publications on my site. I've a content of type "Staff" that display all workers. These workers have publications that are listed on the publication page (using the biblio module).
Now the Staff node has a field name (wich content the workers first and last name). Now I want to list all biblio (publications) that has the same "Author name" as "Staff name" on a staff page.
The idea is to link Staff name with biblio Authors name, and use this to list every publication containing this workers (staff) name on this particular workers page.
At the end, I'll habe to add pulbications just once and they will be listed on every workers page containing the name of the author.
How can i achieve this? I've tried everyting i could, but could not find a solution. Thanks for your help.


texts: Cannot add new release for new contrib project

texts:
I've recently promoted my project from sandbox
My project's "default branch" is set as 8.x-1.x
I've got a tag on my latest commit -- 8.x-1.0-alpha1 -- which is listed on my project's "git tags" area
As far as I can tell, I've followed the release naming conventions outlined on https://www.drupal.org/node/1015226

However, when I try to follow https://www.drupal.org/node/1068944, I do not see an "add new release" option at the bottom of my project page (or anywhere else). Any suggestions for what I may be doing wrong?

I see that dev releases appear to be generated every 12 hours, but the above has all been set up for longer than 24 hours.


texts: dns-prefetch on multi language site - only shows on one, incorrectly

texts:
During an automated search for broken links on our sites I found this faulty line in the <head> section in ONE of our sites (out of 8 TLDs running on the same Drupal installation):

<link rel="dns-prefetch" href="//languages" />

The only traces of dns-prefetch I can find in the code is in the Advanced CSS/JS Aggregation module, which also has some admin settings regarding this:

I tried checking Preconnect (recommended), but that just generated a new faulty line:

<link rel="preconnect" href="//languages" />

Interestingly, when I open the languages table in MySQL, the only language that has a value (a 43 character hash/salt string) in the javascript column is the same that shows the faulty dns-prefetch value. Coincidence?

The goal is of course to get dns-prefetch to work, and to do so on all sites. I'm a bit clueless on where to start though. Is languages an array or object that doesn't get printed properly somehow?

SETUP: Drupal 7.58 / PHP 5.4.16 / 5.5.56-MariaDB / Apache/2.4.6 (Red Hat Enterprise Linux) / Advanced CSS/JS Aggregation (AdvAgg) 7.x-2.33
(we're planing to upgrade to PHP 7, just not there yet... :-)

UPDATE:
The value in the languages => javascript DB-column does indeed affect this. The value is printed as a part of a aggregated JS-path. This path has also "//languages" as the initial part of the path, instead of a proper domain or relative path.


texts:
I have two roles Editor and Manager. Editor can add nodes as unpublished and manager can review the nodes and approve/publish them in website.

For administration I am using default SEVEN theme for adding/editing nodes. How can i hide "Save and Publish" button to editor role only?

Can it possible by calling a template hook node_presave? I tried below code but not worked.

 function seven_node_presave($node) {
    global $user;

    if (in_array('editor',$user->roles)){
        $node->status = FALSE;
    }

}

if any body can suggest solution for this?


texts:
There might be a really simple answer for this, but I haven't found it yet.

I'm using a view with a few exposed filters.  The form it generates is too basic, and I want to restructure it a bit, with some "+ advanced" expanding/collapsing divs and things like that.

What method do I hook for this?  Or is there a better way?


texts: How to make an existing content type a product in Ubercart 3 and Drupal 7?

texts:
This is a follow up to this question. If I go to admin/store/products/classes, then I can only create new content types:

The problem is, I have another content type, called "product", which I need to set as an UberCart product. And I create this class in ubercart that has now resulted in a new content typed called "Basic Product". When all I really want is for the existing product to be considered as an actual product.

When I edit the "product" content type, I can see it doesn't have the same options as the "basic product" content type:

So the question is: how do I make my EXISTING "product" content type an Uber Cart product? I checked under classes and that only seems to work if you want to create a NEW content type.


texts: I have a field in my node i.e. a cck date field with pop up. I want to control the size of this box. How do i do it. I tried hook_form_alter and found less success.


texts: Free Shipping for selected products in Drupal Commerce

texts:
I'm trying to set up a rule to allow free shipping for selected products. I'd like to use a boolean field with a checkbox for free shipping. If the box is ticked the product should be excluded from any postage calculations during the checkout.

I'm using the commerce and commerce shipping module.

Any help would be greatly appreciated!


texts: Page not found without record about page

texts:
Is there a way to find the source of an error that I have on my production site during the last few days? In reports/dblog I see an error "Page not found" but there is no any information about what page, source, time of this error.

EDIT I looked in phpmyadmin and saw the source of the problem. The error appears when user reposts node in livejournal. I don't know is it a big problem for website or not (I mean problems with perfomance or search engines). Does anyone know the answer on this last question?


texts: Drupal doesn't detect my MySQL installation

texts:
Does Drupal 7 use some special libraries for MySQL?
I tried to install the 7.8 version, and the only option for the database I have is "SQLite."

I am running Drupal 6 on the same server, and it works fine.
I am using PHP 5.2.8, and MySQL 5.1.38.

Do I need any additional library?


texts:
In D6 we could configure a webform field to pull profile data by using  a token like %profile[key] and assigning the user field to the form (Details here).
How can we to something similar in D7 using the user fields instead of the profile fields?


texts: I have used configuration management to export and import my drupal configurations.However,when i add a new block,the configuration management can't track the change of block and i can't export the configuration.I want to know whether the configuration management can track the block and export block configuration.


texts: Add link gone from main menu and getting errors when trying to add new menu item

texts:
Running D7

For some reason the add link is gone from the admin menu view...can only edit but can't add any links or menu items, getting errors also:

Warning: Illegal string offset 'hierarchical_select' in
drupal_array_set_nested_value() (line 6776 of
C:\aquiasites\redoII\includes\common.inc).

Fatal error: Cannot create references to/from string offsets nor
overloaded objects in C:\aquiasites\redoII\includes\common.inc on line
6776

I disabled hierarchical_select to no avail...I can't find the view to control those settings, but this is a core view right?

Usually menus say:

    list links    edit menu    add link

But now these options are gone...

It only says:

    MENU LINK   ENABLED TARGET  OPERATIONS


texts: Entity reference - hide some references in multiple-reference field edit widget

texts:
I have a node (group) with an entity reference field that is used to link it to other nodes (stations). The relationship between them is 1:N (one group : many stations).

The problem is that I need to limit the edit widget so that certain users can see (and also edit) only specific station links. I have no problems with limiting which stations can be added, I know that I can easily do that via custom validation + entityreference selection widget.

The real trouble is with limiting which already existing references to stations can be deleted / viewed. Imagine that I have this structure:

user1
user2

Group1
-station1
-station2
//User1 is allowed to see (and edit) only station1, user2 only station2.

Then I'd need to edit the Group1 edit form in a way that when user1 access it he/she only sees the station1 in the stations references widget (and can therefore remove only that referece). Following the same principle, when user2 access the group1 edit form, he/she can only see (and edit) the station2 reference.

I know how to limit the deletion itself via setting the '#disable' property of the individual reference...

$form['entity_reference_field_name']['und'][1]['target_id']['#disabled'] = true;

...but that doesn't hide, just disables it for removal.

There's also the possibility of setting the '#access' property of it which actually hides the record, the problem is that it looks just terribly ugly (and like a clear 'hack').

$form['entity_reference_field_name']['und'][1]['target_id']['#access'] = false;

I can't unset the reference because it would delete it.

So, does anyone have any idea how to it? Preferably without having to clone the entity reference module and editing its core.


texts: Why the commit is not shown in the issue after it is closed as fixed?

texts:
Yesterday I saw that I forget to commit a change in a 8.x branch of a project, so I search for the commit message in the 7.x branch and I commit the changes and push my code to drupal.org, but today I see that the commit appears in the project page but not in the issue.

If you go to see the commit you will see the issue number and reference:

https://www.drupal.org/commitlog/commit/43654/082f754b0f3780979663afea014df3cb84d0eeec

  Issue #2846726 by ...

But in the issue page the commit not appears, this can be because the issue have the Closed (fixed) status?


texts: Rebuilding of Garland theme on database migration

texts:
I work on localhost and in the evening I migrate the database, default/files folder, sites/all folder to the production site and restore the site database backup using drush sqlq command.

But on restore the Garland(sub-themed one) on one D6 site breaks. So I'd need to login and go to this theme and them manually do "Save Configuration" in this theme. I also run cron and cache clean all using drush before and after this drush sqlq restore.

In the same way I've another D7 site with Bartik theme which misses only header colors - which I restore by following the same procedure.

I'm also following the same workflow for other four D7 sites which work fine and show no such issues.

I've automatized this procedure except for the inconvenience for this manual intervention for my 2 out of 6 sites.

Is there any way to regenerate the theme css or the other files by using say Drush?


texts: View with albums listed, plus their corresponding songs

texts:
I feel like I must be missing some fundamental understanding of views or something...

I'm creating a site for a single band. I have two content types, “Album” and “Song.” The “Song” type has a mandatory reference to the “Album” type using Entity Reference. I have a field for the album cover and year of release in “Album” and I have a track number field in “Song.”

I want to create a page (/music) that lists all albums they have (sorted by year released), with the list of all songs (sorted by track number) for each album displayed along with the album title and cover. The album title and cover would be on the left with the songs listed on the right (two columns, basically).

The Daughtry site had it arranged very similarly to what I was looking for a few days ago, but now it only displays one album. Still, imagine this page with multiple albums showing: http://www.daughtryofficial.com/us/music/

I have gotten very close using a view with the appropriate relationship if I grouped by the album title. The main problem was that the album cover would show for each song instead of once per album. I worked around that by hiding the album cover field and rewriting the output for the album title field to include the album cover. This makes it a bit tricky for formatting, though, as now they are both in the same “field” I guess you could say. And if I want to add more fields that would show only once per album, I would just have to keep rewriting the album title field.

I also tried an attachment view, but that asks if you want the attachment before or after the view, so it would list all albums and then below that list all songs for all album. So they weren’t linked, it was just two separate lists.

Is that the best I can do or am I totally missing the “right” way to do this?

I'm new so I can't "post" images, although it did upload them:

http://i.stack.imgur.com/jFOK7.png
http://i.stack.imgur.com/Ynq65.png


texts: Using views how to display taxonomy term description in D6?

texts: How can I display taxonomy term description next to taxonomy term in a views field?


texts: What is the correct way for a Drupal 8 custom theme to override the JS collection renderer?

texts:
I would like to implement a custom theme, and in my theme, I need to change the way that JavaScript is rendered. By default, Drupal 8 will use the Drupal\Core\Asset\JsCollectionRenderer class, and create a bunch of html_tag render arrays.

I want to change this to allow returning just the name of the JS file, so I can present it in a different way using Twig.

It would appear that I need to define a ServiceProvider class that can register a change to asset.js.collection_renderer (core.services.yml), and implement a custom class to replace JsCollectionRenderer's behaviour.

However, it looks as though I would need a custom module in order to get the ServiceProvider's register() method to fire.

If possible, I wanted to avoid needing a custom module just to have a custom theme, because that seems like needless overhead, so I'm wondering if there's a way to fully encapsulate this behaviour in a single theme, or whether my approach is misguided in some way and there's a better way to handle this.


texts: let the user choose role upon registration

texts:
I'd like to let the front-end user to choose user role upon registration.

When the register form submit, I'd like it to redirect to the respective profile page concerning with their chosen role.

I use profile2 module and profile2 registration path module.

Is there any existing module for that ?

Thanks in advance!


texts: Migrate Image Cache presets to Image Style Drupal 7 Upgrade

texts:
I have recently upgraded my site to drupal 7 which uses Image Cache module. I migrated all the presets to Image Styles using the script mentioned in the below link.
http://drupal.org/node/1316472

When I visited nodes in my site, it shows me big images irrespective of the style that's applied  to it. In some nodes, the images are missing.
I have few cck image field associated with few node types.

So whats the correct step I should take to upgrade my drupal site such that all the images are displayed with the correct image style effects applied to it.

I searched for documentation on drupal image & image cache modules upgrade, but didnt find any. Please guide me through the process.


texts: How to get the referenced node id in a webform?

texts:
I have a webform that is connected to a node in drupal 8. When the webform loads from the node link I need to get the source entity id from url.
How can I achieve that in my custom module? the url is as follows:
https://example.com/en/form/edu-form?source_entity_type=node&source_entity_id=134

I tried the following but I get an error:

 $node = \Drupal::routeMatch()->getParameter('source_entity_id');
 $nodeId = $node->id();

And also this (I tried to get the node id from the webform object)

/** @var \Drupal\webform\WebformRequestInterface $request_handler */
$request_handler = \Drupal::service('webform.request');
$source_entity = $request_handler->getCurrentSourceEntity('webform');
$node_id=$source_entity->id;


texts: Node/add and node/edit do not display forms

texts:
I am logged in as an admistrator account and all relevant permissions are enabled for admistrators(some rights to delete a few types are disabled).

When I attempt to edit or create an event I get a page with a bread crumb, a title and no actual form or styling. I checked the html and the form isn't being sent and just not displayed either. I am using drupal 7.14 and this setup was working before moving it to another server.


texts:
I'm currently using drupal 7. I want to create an album gallery with different category. I wish to put "Albums" in the main menu, with the categories as sub menu under "Albums".

I had created a content type "Album", and plan to use taxonomy to creating vocabulary and terms as category.

However, I wish to make it automated. Once I create a album category, it will automatically appear in the sub menu under "albums". And each category will link to the list of albums under the category.

Anyone knows how to achieve the effect?


texts: How do I bootstrap from my /app.php without `Page not found`

texts:
Introduction
There are lots of bootstrapping questions and answers on how to bootstrap but I haven't found how to not get Page not found watchdog notices. Using these question and answers I came up with this bad solution cut and paste from the actual code.
/app
Assuming Drupal core is located in ./www/core and my app in ./www/app
// ./www/app/index.php
// =========== APP SECTION ==================

define('DRUPAL_ROOT_FOR_APP', $_SERVER['DOCUMENT_ROOT']);
define('APP_ROOT', __DIR__);

$protocol = stripos($_SERVER['SERVER_PROTOCOL'],'https') === true ? 'https://' : 'http://';
$base_url = $protocol . $_SERVER['HTTP_HOST'];

$current_dir = getcwd();

// =========== DRUPAL SECTION ==================

// CR https://www.drupal.org/node/2275139
// CR https://www.drupal.org/node/2409067

use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;

// Preserve app settings
$app_settings = [
  'SCRIPT_FILENAME' => $_SERVER['SCRIPT_FILENAME'],
  'SCRIPT_NAME' => $_SERVER['SCRIPT_NAME'],
];

// Set drupal context
$_SERVER['SCRIPT_FILENAME'] = DRUPAL_ROOT_FOR_APP . '/index.php';
$_SERVER['SCRIPT_NAME'] = '/index.php';

chdir(DRUPAL_ROOT_FOR_APP);
$autoloader = require_once DRUPAL_ROOT_FOR_APP . '/autoload.php';

$kernel = new DrupalKernel('prod', $autoloader);

$request = Request::createFromGlobals();

// This generates page not found <========================
$response = $kernel->handle($request);

$sess = \Drupal::getContainer()->get('session');

// Restore script context
chdir(APP_ROOT);
$_SERVER['SCRIPT_FILENAME'] = $app_settings['SCRIPT_FILENAME'];
$_SERVER['SCRIPT_NAME'] = $app_settings['SCRIPT_NAME'];

$user = \Drupal::currentUser();

/** @var \Drupal\Core\Entity\Query\QueryInterface $query */
$query = \Drupal::entityQuery('node');

// =========== APP SECTION ==================

require_once __DIR__ . '/../src/classes/AppDrupalInterface.php';

require __DIR__ . '/../vendor/autoload.php';

...

I think the answer lies in not using $response = $kernel->handle($request);.
I tried using $this->kernel->preHandle($request); mentioned in Cannot get currentUser after custom Drupal boot but failed that time.
Watchdog
Having ./www/app/index.php request to /app leads to /app 'Page not found' notices in Drupal watchdog. Same goes for all /app/** requests.
Question
How do I prevent these notices by changing what part from the code above?


texts:
I have a hosting account which has a maximum of 250 MB total space. I have installed Drupal 8 and I'm using the bootstrap theme and already my host has warned me that I am nearing my limit for file space. This is only going to be a small site, so it really shouldn't need that much space. Is there any way I can clear up space by deleting unused files in the Drupal 8 system?

For instance, is it possible for me to disable themes and then delete those folders? And also to uninstall core modules that I'm not using and delete those folders as well? Or are there any other ways I can clear up space?

If it is not possible then I will probably switch to using Drupal 7, which would be my 2nd option.


texts: Where can I get permission string to use with user_access?

texts:
There is a long permission list at admin/people/permissions.
For example there is permission with title Article: Edit any content.
But where can I get the string which can be used with function user_access()?


texts: Given that db_select is much slower than db_query, why would I want to use it?

texts:
For the background on this, please see http://drupal.org/node/1067802.

Given all that, what situations exists where I might want to use db_select(), or should I be relying solely on db_query?


texts: Need to override single Drupal 8 plugin function

texts:
What I want to do is edit what is displayed in the autocomplete/drop selects for an entity reference. Basically instead of just [title] I want to show [title] - [other_distinguishing_field]. I know that I can do this by editing getReferenceableEntities in Drupal\Core\Entity\Plugin\EntityReferenceSelection. All I want to do is override that function. I read that I need to make a plugin for this, but I find all of the tutorials a bit confusing and I don't understand how to implement what I want using a plugin.  Do I need a plugin manager? Do I need to use annotations? Where do I reference Drupal\Core\Entity\Plugin\EntityReferenceSelection? Where do I override the function? Do I need to configure anything on the UI the use my plugin or will it automatically work?

**EDIT
Here is what my Plugin manager looks like using the solution provided by @ya.teck

    <?php
/**
 * @file
 * Contains ExampleEntityReferenceManager
 */

namespace Drupal\example;

use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;

/**
 * ExampleEntityReference plugin manager.
 */
class ExampleEntityReferenceManager extends DefaultPluginManager {

  /**
   * Constructs an ExampleEntityReferenceManager object.
   *
   * @param \Traversable $namespaces
   *   An object that implements \Traversable which contains the root paths
   *   keyed by the corresponding namespace to look for plugin implementations,
   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
   *   Cache backend instance to use.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler to invoke the alter hook with.
   */
  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
    parent::__construct('Plugin/EntityReferenceSelection', $namespaces, $module_handler, 'Drupal\Core\Entity\EntityManagerInterface', 'Drupal\Core\Entity\Annotation\EntityReferenceSelection');

    $this->alterInfo('example_entity_reference_manager_info');
    $this->setCacheBackend($cache_backend, 'example_entity_reference');
  }
}


texts:
I am creating a user account programmatically with the following code.

$fields = array(
  'name' => $first_name,
  'mail' => $mail,
  'pass' => $password,
  'status' => 1,
  'init' => $mail,
);

$account = user_save('', $fields);

When I am trying with same name again, it throws an error, but by default it updates the name.

How do I update the name if already exist?


texts: Parent-child-grandchild relationship for content or comments

texts:
Background

I am creating online courses, where groups of students work together giving answers to questions and commenting on each others answer.

I'm using Drupal 8, probably with Panels.

Challenge

I will have a content type called “Question”, created by the course creator.

The page for each Question should have:

the content of the Question, followed by
a list of (some of) the “Answers” from other students, showing the students name, the text of their Answer, a count of how many comments from other students the answer got, and a "show comments" link that shows the comments and offers a form for a new comment

a “new Answer” form where students can post their own Answer to the Question

Possible routes

I can see 2 ways to achieve this:

A: Treat top-level comments as "Answers"

AFAIK comments can be threaded, so I could treat the top-level comments as "Answers" and lower-level comments as "Comments". I could use a custom view block to only show the top-level comments on the “Question” page.

In this case, how would I enable the full text of the Answer and its child comments (the comments on the “Answer”) to show up (by AJAX or on a different page) when the reader clicked “show comments” on an answer?

B: Have “Answers” be a content type

The Answers content type would have an entity reference field “Question” that holds a reference to the parent Question.

This works well, but how would I insert a “new Answer” form which automatically and invisibly prepopulated the "Question" entity reference field with the id of the current Question?

Possible solutions seem to include

using the module formblock, which has a D8 port
porting the module entityreference_current to D8.
Creating a view that returns only the current Question id (by using Views contextual filters), having that view as the source for the entity reference field on an entityform, and finding some way to hide the field. This approach I found here: Reference to parent node on entity form type. This looks good and simple - any drawbacks?

Am I understanding the options right? Is there a better/different way to achieve this?  My impression is that Option B  - a second content type - is more robust and flexible?


texts: how do i add last name new field in default user registration page

texts:
how do i add last name new field in default user registration form my code is

$form['account']['lname'] = array('#type' => 'textfield',
  '#title' => t('LastName'),
  '#default_value' => $edit['LastName'],
  '#maxlength' => LASTNAME_MAX_LENGTH,
  '#description' => t('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.'),
  '#required' => TRUE,
);

but i don't know how to show last name field in default user registration form?


texts:
I am new to Drupal and for some time now I am trying to figure out how to control access to nodes.
After figuring out that no module will give me what I want and deciding that I will have to get my hands dirty and write my own.

The problem is that nothing works and in no way I can restrict access to nodes.

To make things simple I tried blocking everything to anything in any way I found, but it makes absolutely no difference.

function mymodule_node_access_records_alter(&$grants, $node) {
  $grants=array();
}

function mymodule_node_access_records($node) {
  return array();
}

function mymodule_node_access($node, $op, $account) {
  return NODE_ACCESS_DENY;
}

The module is loaded by drupal, it is parsed (I get error messages when something is wrong), I tried clearing the cache, tried loading the module on and off, I disabled OG Access Control (I still have OG field access running).

The OG access modules are working more or less correctly (sometimes they block what you want them to block).

I am probably forgetting about something obvious but I feel like I tried everything.


texts: Installing a site from existing configuration

texts:
I tried importing a configuration after installing Drupal 8 using the standard installation profile but was getting into errors related to the installation profile being already present.

I need a clean drupal slate with only the configuration and no content.  Is it possible to do that?


texts: How to make persistent exposed filters in views

texts:
I'm aware of the "remember" option of views, but it is stored in session data (not persistent if you logout) and I want to keep the selections saved forever (so the users only have to do the selections once when they sign up).

I've done quite a lot of research regarding different options that maybe could do the trick, but haven't found out yet a viable solution to it. The options I've researched are:

1) With the module "views saved searches" (works but for usability reasons is not an option in this case)

2) Coding a way to remember the exposed filters selected via cookies or database (I haven't found anything about this and I don't know how to code a solution myself).

3) Making the selection in a node or profile page (with CCK, Nodereference/Entity Reference or Relation fields) and applying the selection of each user to "personalize" their view accordingly (maybe following one of the two options briefly mentioned in point 3 of this answer: https://stackoverflow.com/a/1409382 or using advanced features of relationships and/or arguments)

Any help would be appreciated.

Thanks!


texts:
I am creating a module that needs to add a number of fields to all commerce product types.
In Drupal 7, I used the function commerce_product_types() to get all the types and than used that, but I can't seem to find the equialent in Drupal 8. So, I have commerce product type 'default', but I also have 'radios', and 'computers'. I don't know how many types there will be on the website, so it needs to automatically detect all types.


texts: Preprocess function trying to alter title

texts:
I have used this code in template.php.

function mytemplate_preprocess_node(&$variables) {
  $variables['title'] = "trial" . check_plain($node->title);
}

I was trying to alter the page title, and wanted to make a test before. When I use that code, the title disappears from the teaser. Do you know why?


texts: Is there a way to pass a PHP value to JavaScript?

texts:
I have a link generated within a JavaScript file that contains the following code:

jQuery(".url").append('');

I would like to alter the path variables when user is not logged. In Drupal terms this would look like: global $user; if (user->uid == 0) {..redirect page.} or global $user; return !(bool) $user->uid;

How can I use the $user->uid property with JavaScript code?


texts:
I'm having trouble setting the cookie lifetime in my D8 instance.  I'd like to set it to zero so that closing the browser logs-off the user.

I've added ini_set('session.cookie_lifetime', 0); to the site/default/settings.php file.  There was no previous cookie_lifetime reference in the file.  I added the line.  I've also cleared the Drupal cache and cleared my Chrome cache.  Sadly, it's not being respected.  Sessions still persist after browser close.

I've searched the entire codebase for ini_set('session.cookie_lifetime', 200000); but it doesn't appear to exist in my site. I don't see where Drupal is setting the cookie lifetime.  I've also tried adding the setting via a php.ini file in the root but that's being over-ruled by Drupal.

I feel like this is a simple thing, so I'd like to avoid plugins. Looking forward to hearing from everyone.  Thanks in advance.


texts: How to use rendered file entity in view header as background image for view

texts:
I would like to set a background image on a div in my views-view.tpl.php using the image from a rendered entity field in the View Header.

Something like:

      <?php print render($title_prefix); ?>
      <?php if ($title): ?>

<?php print t($title)?>

      <?php endif; ?>
      <?php print render($title_suffix); ?>

      <?php if ($header): ?>
        <?php print $header; ?>
      <?php endif; ?>

How do I print just the url of the entity from the header? It would be great if I could pull the image URL and add an inline style on the group-header div. Any ideas on how to accomplish this?

Similar to this question: Use image from view as background image of div in page.tpl.php


texts: is it good idea to add js file for every page?

texts: I have some JS and CSS on my site that are very specific to some pages.  From a Drupal perspective, it is good idea to add them using drupal_add_js() instead of THEME.info?  Does such thing affect caching, or anything else Drupal-specific?


texts: Boost Cache helps some pages, hurts others?

texts:
I'm working on fixing some performance issues of a Drupal 6 site. Very new to Drupal, been figuring things out as I go, so please bear with me here.

My client has a rather busy site and uses Boost cache. On pages where Boost cache is applicable -- their home page, reviews pages, etc,... -- it works great. Pages are fast, load testing shows that they can take whatever's thrown at them. I just discovered that with Boost enabled, pages that are not eligible for its caching, such as pages with polls that need to pull from the DB each time, they are significantly slower to load then when Boost is disabled entirely.

For instance, here are the Loader.io results of a page in question. The instances where it completed successfully were with Boost disabled, instances where it failed were with Boost enabled. Ignore that 100% error rate test that's second from the top, MySQL actually crashed after the previous test and I forgot to restart it before running again.

All I know for sure is that the errors are caused by MySQL. It appears that Boost adds database overhead, maybe it has to check for information about cached pages and then it has to do a second query to draw the page if it doesn't find the cached information? I'd love any insight anyone can provide!

Edit: Screenshot of Boost expiration settings


texts:
I installed drush on Mac and tried running drush omega-guard from within my theme directory like I had done before on linux. However I keep getting this error:

  The drush command 'omega-guard' could not be found.  Run drush [error] cache-clear drush to clear the commandfile cache if you have
  installed new extensions.

I have no idea what to do about this. I saw further on down in the error log that it was trying to connect to Site URI: http://default. I have my Site located in my Dropbox folder so the location of the actual drupal site would be Dropbox/Sites/drupal. I also have an alias set for this so I can visit it at drupal.dev in the browser. I don't know how to communicate this to Drush (nor why it is necessary all of the sudden).

Any help would be greatly appreciated!


texts: How to decide between module_exists and function_exists?

texts:
I'm familiar with using module_exists in a module, and using it in situations like:

Enable some extra functionality in a module, provided some other module is available in the site also. The Reservations: Email module contains an example (actually there are plenty of examples of this), as shown in its module source: to use tokens (in the eMail body) requires that the Token module is enabled.
Implement module dependencies in a theme, as shown in the answer to "How to implement module dependencies in a theme and package modules with a theme?".

However, there is also function_exists, such as shown in the answer to "Is it possible to declare a Javascript library dependency at Hook.info?".

I have the impression that using function_exists is a more robust (safe) approach as compared to module_exists. Especially if you want to be sure that some function (added in a newer version of a module) is available, whereas by just using module_exists, you risk to run into errors like those:

if a site is still using an old version of a module, which doesn't have that function yet (so you shouldn't try to use it  yet).
if a site is already using an new version of a module, which doesn't have that function anymore (so you shouldn't try to use it  anymore).

My question: what are the typical criteria, or pros/cons, to decide for using either  module_exists versus function_exists?


texts: hide JSON:API endpoint parameters for a client application

texts:
The Existence
I 'am using the JSON:API core module to serve a  client (react application)
so that each time I have made a back-office modification I  need to reconstruct the URL parameters  ex :

to send the feature image information
?include=field_featured_image

then I have added a paragraph to my article content type so to include the paragraph:
?include =field_featured_image,field_composants

to display specific element in the created parapgraph and not all fields I have use the field set
?include =field_featured_image,field_composants&fields[paragraph--composant]=video

and so on the modification keep going...

then I need to send the new endpoint to the client (ex: react application)
The problem
the client is not up to date with the new URL so each time I made a modification I need to communicate it to the front team.
What do you think about this solution
THE JSON:API parameters will be like BlackBox for the react application :

REACT sends a request to DRUPAL without sending any parameters  ex:
GET /jsonapi/node/article/55d611ab-5752-469a-bf44-648c8cad2a9f
OR
GET /jsonapi/node/article

on kernel.request Drupal takes the request url and alter it by appending the proper JSON:API parmters  to it ex:
/jsonapi/node/article?include =field_featured_image,field_composants&fields[paragraph--composant]=video

NOTE:

for easy administration The JSON:API parameters will be configurable from BO.
The request handler method can change the parameters according to the requested node bundle or according to collection or single entity request

using HTTP client ex(GuzzleHttp\Client) to request the new constructed JSON:API endpoint
$res = $client->request('GET', '/jsonapi/node/article?include =field_featured_image,field_composants&fields[paragraph--composant]=video');

problem: for each request instead of a single request I Nedd to execute 2 requests.

4.then send a response to the client :
$event->setResponse($response );
note: for a technical reasons I prefer to keep using JSON:API and not creating custom rest endpoints.


texts: How to convert my site completely to angularjs?

texts:
I want my site to act realtime completely. There is a nodejs module which is easy to setup I guess with lot of other modules available to provide integration with nodejs.

There is also a module available to integrate ajax with nodejs on drupal as drupal site uses ajax, specially when we are using views. Just for information I have read that

  nodejs has some security issues and should not be used and angularjs
  should be the choice.

How do I integrate the site with angularjs to make it a real-time application almost completely?

I know there are few modules like ngapp and Angularjs, but do not know whether it is what I am looking for.

Note: If setting up angular is complex for a beginner like me, then I will prefer nodejs because it is easy to setup and some third-party modules also integrate with nodejs.

If I get proper guidance, I am willing to do the hard work.


texts:
I have to fetch nodes where it doesn't have both roles(6,7) in it,at the same time  exactly.

I don't want to show role 7 nodes, but it some times have role 6 attached to it also ,at that time i want to omit those nodes.

This is the query which i wrote for that

$nids_result = db_select('node', 'n');
$nids_result->join('users','u','n.uid = u.uid');
$nids_result->join('users_roles','ur','u.uid = ur.uid');
$nids_result->fields('n', array('nid'));
$nids_result->condition('ur.rid', 7, '<>');
$nids_result = $nids_result->execute()->fetchAll();

But this is fetching me all nodes including role 7 also,because role 6 is also some times available in the nodes.

How do I write and condition where it checks for both 6 and 7 roles are available and omit those nodes.Thanks in advance.


texts: How to make the Edit User Profile to have all tabs in one page?

texts:
If I load this page
http://domain.com/user/1/edit

I have on top more tabs that I have to unify into one page

I've added some custom fields to the user profile that adds some more tabs when I go into

http://domain.com/admin/user/profile

so that adds the tabs that I need to appear in the same page as http://domain.com/user/1/edit

how can I do that?

note that I'm using Drupal 6.19


texts:
I want create a multi language website, I have some problems,
according my search about menu link in multilanguage  drupal website ( I did this job in some year ago but forget it(because some personal life change I abandon drupal form 1 year) ) it is better to create  seperate  menu type and put them in menu block (with menu block moudle ).but I have some problesm,
first How can I restrict block  shows in only specify language , I want did it in cofiguration of block in pages section limit it by something like
en/*  but in front page of my two languages not work correctly,
please tell me how can I restrict blocks in languages.


texts: How do I add fields to the standard Drupal contact form? Can this be done programmatically or is it a task for a module?


texts: Show node in overlay using drupal 7 overlay module

texts: Is there anyway to open a overlay with a node content using drupal overlay core module? If I could reuse at least the javascript code I'd already be happy =)


texts:
I have Drupal CMS and I need to protect it from sensitive data leak, which are the customer names, addresses, the payments and order information.

I am new to Drupal, so my question is, is it possible to run each module in separate security context, so if one module gets exploited, the other data is not compromised? Is Drupal OOP based? Has drupal administration separated from the frontend? Would be these two achievable at all? I saw the LDAP module, which helps, but it doesnt help with the customer data...


texts: How can I tell which site uses which database?

texts:
I have a multi-site Drupal installation that's misconfigured. The settings information has been confused, and I need to map databases to particular sites. I am tasked with cleaning up the mess.

For any given database from a Drupal installation, what tables can I look at to see which site was using it?


texts: How do I programmatically fix local menus to be shown only for a content type?

texts:
I am using the following lines in a links.task.yml file.
x.nodename_updates:
  route_name: view.great_view_name1.page_1
  base_route: entity.node.canonical
  title: 'Updates'
  weight: 50

x.nodename_subscriptions:
  route_name: view.great_view_name2.page_1
  base_route: entity.node.canonical
  title: 'Subscriptions'
  weight: 50

The submenus are shown on all nodes. I would like to show them for a single content type, but when I use the entity name in the base_route such as entity.TYPE.canonical, it doesn't work. It works for other entities that are defined in classes with annotations.
I know it is possible to fix it through hook_menu_local_task_alter(), but this is something I believe can be fixed within the links.task.yml file.


texts: Calling a view from code gives no results

texts:
I have a view that I use to grab a related node field given a user ID. I only call this view from code. The problem is, I just can't get it to work for a certain case.

To start with, here's the code that I use to call the view. The view accepts one argument (the user ID) and displays one field (the related node field). (I use multiple displays in this view for different code functions, thus why I build 'block_3'. Also, I'm calling this code from within a "User has logged in" Rule, which is why I use $account instead of global $user.)

$view = views_get_view('my_view_name');
$view->set_arguments( $account->uid );
$view->build('block_3');
$view->execute();

For the user ID "5", this works perfectly. But for the user ID "14", it returns no results. The frustrating part is that in the View settings, I can enter "14" for the preview argument and it ALSO works perfectly!

I'm at my wit's end. Why would the view work perfectly fine in the preview and for one user ID, but not for another?

Some notes

I've confirmed with dpm() that $account->uid is being set properly. I've also changed User ID 14's roles to match User ID 5's, and even swapped the related nodes for the two accounts, but User ID 14 always fails to work while User ID 5 has no issues.
If I pass $view->result to dpm(), I get empty text; dpm($view) returns the $view object, where I can see that $view->result is an empty text.


texts:
I have made a form_alter in template.php in my theme and I have created a custom page (page--checkout.tpl.php) to render my form.
If I render the content as print render($page['content']); everything is fine,
but I want to print the cart content on the top of the page, and the customer_profile_billing and commerce_payment below the cart contents in two seaprate columns. How can i call for these seperate panes in the page--checkout.tpl.php in order to show them the way I need?

I've searched everywhere but it seems that I cannot find something that works for my needs.

Thank you in advance everybody.


texts: How to display a BACK button but ONLY if the user came from somewhere else on my site

texts:
I'd like to display a BACK button on my node--resource.tpl.php file but ONLY if the user came to the node from another part of my site. If they copied and pasted the URL for the node directly into their browser's address bar and got to it that way I do NOT want the button to appear.

Here' the button in my tpl:

<input type="button" value="Go Back" onclick="history.go(-1)" />

Anyone know how to do this with PHP (or another Drupal method)?


texts: How to create a single page using Drupal Commerce containing product, billing infor payment method?

texts:
I'm trying to create a donation form as product, but I want the billing information/Account Information form and Payment method options to be in a single page together instead of having them on a different process page.

Is this possible?

Is there a way to configure this in Drupal Commerce or is there a programmatic way to do this?


texts: How to delete a node with same specific field content and by same user when a more recent one is created in drupal 7?

texts:
I have created a review system allowing users to make a review of a place. One of the fields for each review is the actual location which needs to be filled. If a user decides to create a review of 'the Red Lion' and it happens that she has already written one on that place, I want the old review to be deleted, and only the latest one kept.

I have tried to use Rules with the 'fetch entity by property' and a double loop, but it does not seem to do the trick. Here is the export of a test rule where I just flag the 'former review'. The current result is that it flags all reviews of the 'Red Lion' made prior to the current one being saved. Any suggestions?

{ "rules_delete_old_reviews" : {
"LABEL" : "Delete old reviews",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "flag" ],
"ON" : { "node_presave--review" : { "bundle" : "review" } },
"DO" : [
  { "entity_query" : {
      "USING" : {
        "type" : "node",
        "property" : "author",
        "value" : [ "site:current-user" ]
      },
      "PROVIDE" : { "entity_fetched" : { "entity_fetched_author" : "Fetched node by author" } }
    }
  },
  { "LOOP" : {
      "USING" : { "list" : [ "entity-fetched-author" ] },
      "ITEM" : { "list_item_nodeauthor" : "Current list item" },
      "DO" : [
        { "entity_query" : {
            "USING" : {
              "type" : "node",
              "property" : "field_revlocation",
              "value" : [ "node:field-revlocation" ]
            },
            "PROVIDE" : { "entity_fetched" : { "old_review_item" : "old_review" } }
          }
        },
        { "LOOP" : {
            "USING" : { "list" : [ "old-review-item" ] },
            "ITEM" : { "list_item" : "Current list item" },
            "DO" : [
              { "drupal_message" : { "message" : "This node \u0022[list-item:title]\u0022 is now flagged." } },
              { "flag_flagnode" : {
                  "flag" : "tagged_review",
                  "node" : [ "old-review-item:0" ],
                  "flagging_user" : [ "site:current-user" ],
                  "permission_check" : "1"
                }
              }
            ]
          }
        }
      ]
    }
  }
]
  }
}


texts: Is there an interactive PHP testing tool for Drupal?

texts: I'm in the middle of trying to create some contextphp code and drupal_set_message debugging is getting old fast. Is there any tool that would allow me to specify a url "context" (e.g. /node/6) and then have a PHP editor that could dynamically execute the code in the window as if it was running in that context?


texts: Trouble adding JavaScript inside a custom module

texts:
I’ve got a question about module development that I need some help with.

I’m building a module which needs to have multiple JS files connected to it. The first file, which has the same name as the module works just fine.
But the rest of the JS files, attached the same way are being ignored.
For example:

function mymodule_init() {
  drupal_add_js(drupal_get_path('module', 'mymodule') .'/js/mymodule.js');
  drupal_add_js(drupal_get_path('module', 'mymodule2') .'/js/mymodule2.js');
}

I’m not sure what I’m doing wrong, if anyone has a suggestion or can point me to some documentation it would be appreciated.

Thanks
Stephanie


texts: How to fix my Rule to notify authors of products by email at order completion?

texts:
I'm trying to send email notifications to authors of each products (line-items) in the order at completion.

I have tried many things surrounding the rule below... that is now at a strange point in its life.

I can use the [commerce-order:commerce-line-items:0:commerce-product:creator:mail] trick, but that sends the mail only to the first product owner.

{ "rules_commerce_order_message_admin_order_notification" : {
    "LABEL" : "Commerce order message: admin order notification e-mail",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "3",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "message_notify", "commerce_checkout" ],
    "ON" : { "commerce_checkout_complete" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "commerce-order" ], "field" : "commerce_line_items" } },
      { "entity_has_field" : { "entity" : [ "commerce-order" ], "field" : "commerce_product" } }
    ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "message",
            "param_type" : "commerce_order_admin_order_confirmation",
            "param_user" : [ "commerce-order:owner" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      },
      { "data_set" : {
          "data" : [ "entity-created:message-commerce-order" ],
          "value" : [ "commerce-order" ]
        }
      },
      { "entity_save" : { "data" : [ "entity-created" ], "immediate" : 1 } },
      { "LOOP" : {
          "USING" : { "list" : [ "commerce-order:commerce-line-items" ] },
          "ITEM" : { "list_item" : "\u00c9l\u00e9ment de la liste courante" },
          "DO" : [
            { "entity_fetch" : {
                "USING" : { "type" : "commerce_product", "id" : [ "list-item:line-item-id" ] },
                "PROVIDE" : { "entity_fetched" : { "entity_product_fetched" : "Entit\u00e9 r\u00e9cup\u00e9r\u00e9e" } }
              }
            },
            { "variable_add" : {
                "USING" : { "type" : "user", "value" : [ "entity-product-fetched:creator" ] },
                "PROVIDE" : { "variable_added" : { "event_creator" : "Variable ajout\u00e9e" } }
              }
            },
            { "message_notify_process" : {
                "message" : [ "entity-created" ],
                "save_on_fail" : "0",
                "save_on_success" : "0",
                "mail" : [ "event-creator:mail" ]
              }
            }
          ]
        }
      }
    ]
  }
}

What's wrong with my rule?

Note:

I would prefer using the Rule, but out of desperation, I have also tried to give directly the email whit something like :

$order = commerce_order_load($order_id);
foreach ($order->commerce_line_items['und'] as $line) {
$line_item = commerce_line_item_load($line['line_item_id']);
$product_item = commerce_product_load($line_item->commerce_product['und'][0]['product_id']);
$product_author = user_load($product_item->uid);
$courriels = $courriels . '<' . $product_author->mail . '>,';
}
print substr($courriels, 0, strlen($courriels)-1);


texts: Drupal 7 webform Version: 7.x-4.5 not sending email

texts:
After updating to Webform Version: 7.x-4.5 the email functionality is not working, which I assume it could be due to change in tokens.

I have a Webform as block a  which is attached to product content type and want to send the contact form information which is webform to current node author.

I am using [current-page:node:author:mail] token as a hidden field in the webform, which used to work until I update to new version of webform and since then the worbfrom stop sending email to author email.

What I am doing:

In the webofrm I have a hidden field author_mail where the default value is set to [current-page:node:author:mail]

At the Webform email setting I set E-mail to address to Component: Author Mail.

Any idea what token to use if not [current-page:node:author:mail]?

Is there any way to send the Webfrom content to current page author email?

Thanks for the help.


texts: Admin -> Run Updates, Unresolved dependency

texts:
When I click Run Updates from admin, I got som Unresolved dependency errors.  It told me File Entity (Version >7.x-2.0 required), but I'm using 2.0-beta3, as the next line stated.

file_entity.info is found in sites/all/modules/file_entity/file_entity.info

So what am I missing?


texts: Can I add a custom link to "Main Menu" via hook_menu?

texts:
I'm trying to add a new link to the Main Menu from inside my module.

Currently, this code:

function custom_food_orders_menu() {
  $items['order_food'] = array(
    'title' => 'Order Food',
    'page callback' => 'page_creator_function',
    'access callback' => TRUE,
        'menu_name=' => 'main-menu',
    'type' => MENU_NORMAL_ITEM,
  );

  return $items;
}

...adds the 'order food' link to the 'Navigation' menu. I tried setting the menu name to main-menu, but that does not seem to work.

Is this a limitation in Drupal? If it is, I'll adjust by creating a link to that page manually.


texts: Trouble theming Ubercart's cart page (Drupal 7) using hook_theme

texts:
Ubercart's uc_cart module offers a 'cart' page which I'm willing to have a theme/template. What I did is added following in mymodule_theme():

    'uc_cart_view' => array(
        'render element' => 'page', // IS THIS CORRECT?
        'template' => 'cart', // Located in mymodule/templates/cart.tpl.php
        'path' => drupal_get_path('module', 'mymodule') . '/templates',
    ),

But No luck!

My Question:

Shall I have some other value for render element key? Or shall I have a variables entry? I tried with variables with an empty array instead of render element entry but no luck.

Here goes some more information about Ubercart's uc_cart module so that you can help me solving this issue:

For Your Consideration

Portion from uc_cart_menu:

$items['cart'] = array(
    'title' => 'Shopping cart',
    'description' => 'View/modify the contents of your shopping cart or proceed to checkout.',
    'page callback' => 'uc_cart_view',
    'access arguments' => array('access content'),
    'file' => 'uc_cart.pages.inc',
  );

So I figured out I should use my custom template for uc_cart_view. This uc_cart_view() is a function in *uc_cart.pages.inc* page, I've pasted the function here for your convenience.

Any help on what I'm doing wrong?


texts: Loading field and rendering on demand using field API

texts:
I am curious to know if there is a way for one to load a field e.g entity reference field that is currently being used in a node context outside of node. example in an admin settings page or in a web forms settings page.

I am able to load my custom field with the following entity_field.manager service, but how would I render this filed and add it to my $form array ?

     function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
      $refrencedField = \Drupal::service('entity_field.manager')->getFieldDefinitions('node', 'my_field');
      if ($form_id === 'webform_settings_form') {
          $form['page']['custom_name'] = [
            $refrencedFiled
          ];
      }
    }


texts:
I'm having issues on our Drupal 7 site. We have created a new content type that includes a hero image. The problem is that full sized images that we upload aren't displayed on the page (despite calling for "Original image" in the manage display settings.

Instead, the page is displaying the image in Drupal's "large" image style, then scaling up on the page and creating a blurry image.

Here's a test page: https://claremontmckdev.prod.acquia-sites.com/content/history-0


texts: How do programmatically create fields for content types, and ADD them to the the content type form

texts:
Say I have this field, "map_description". I know I would this function to define the field:

$field = array(
  'field_name' => 'map_description',
  'cardinality' => 1,
  'type' => 'text',
);
field_create_field($field);

And I have this code which I'm not sure what it does but I'm told that I'll need it:

 $instance = array(
    'field_name' => 'map_description',
    'label' => 'The map description.',
    'bundle' => 'my_content_type',
    'entity_type' => 'node',
    'widget' => array(
    'type' => 'text_textfield',
 );
 field_create_instance($instance)

Those two code bits are both in my install hook and run when I install the module. But while the fields are in fact created, I have to manually assign them to the content type via "manage fields", is there a way to have the fields automatically assigned to the content type?


texts: On AJAX-Enabled Views the "Add to Cart" button does not work properly

texts:
On AJAX enabled Views with exposed filters or pagers the "Add to Cart" button and "add to wishlist" does not work properly.

After an AJAX call, the add-to-cart form action changes to views/ajax, so if i press the button, only a JSON output will be displayed.


texts: Body fields gone on all pages after upgrade to Organic Groups 7.x-2.3

texts:
I'm having a big issue where the body content from all of the pages of my site -- even those that have nothing to do with Organic Groups -- has vanished since I upgraded to OG 7.x-2.3. I've searched dozens of posts in different forums and can't find an answer.

I originally thought the problem was limited to OG because the text that users had entered into each group's posts disappeared after the upgrade. But then I looked at other pages of my site, and wherever the body field appeared in other nodes (both the summary text of teasers and expanded full content), the text had also disappeared. Only the body text is affected; users can see the title, "submitted by" line, and "read more" link in the teasers, and they can see the title and "submitted by" line in the full content node, just not any body text.

The weird thing, though, is that if a user clicks on the "edit" tab, they can see what they wrote; it's only when they hit "save" that it disappears.  I've made sure that the body content in the CCK fields isn't hidden; I've tried changing the format to "plain text" and other formats; and I've tried disabling the OG Field Access module and the OG Context module, clearing the cache, and then re-enabling them (something a lot of people suggest doing), but nothing seems to work. I've even tried disabling the WYSISYG-related modules to see if they were the culprit, but it didn't do the trick.

Does anyone have any ideas as to what the problem could be? I've been tearing my hair out over this for a long time and can't fiture it out.


texts:
I am trying to create functionality where administrator can upload header image whenever he wants.

I' using hook_form_system_theme_settings_alter in theme-settings.php and altering form like this:

 $form['theme_settings']['background_file'] = array(
        '#type' => 'managed_file',
        '#title' => t('Background'),
        '#required' => TRUE,
        '#upload_location' => file_default_scheme() . '://public/backgrounds/',
        '#default_value' => theme_get_setting('background_file'),
        '#upload_validators' => array(
            'file_validate_extensions' => array('gif png jpg jpeg'),
        ),
    );

in template.php using hook_preprocess_page and doing this in it:

$fid = theme_get_setting('background_file');
$loaded = file_load($fid);
$variables['background_url'] = file_create_url($loaded->uri);

and trying to reach $variables['background_url'] from tpl.php file.

When I upload image everything works great, header image is set properly and code has no problem but after a while, I don't really know what happens, for example after 1 day file_load returns FALSE, I just reupload image and everything works fine again.

theme_get_setting('background_file'); always returns file id without problems.

I am missing something? I can't find source of problem.

Thanks.


texts: Include theme stylesheets after base theme stylesheets

texts:
I'm using Tao as a base theme in Drupal 6. However, The base theme stylesheets are being included after the sub theme ones which is causing the base theme to override the the sub theme. As a result Tao's reset.css is coming after my theme stylesheets. Is this correct Drupal 6 behaviour?

My subtheme.info file looks like:-

core = 6.x
engine = phptemplate
name = Sub theme
base theme = tao

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


texts: Exclude node referenced from Related Views

texts:
I have a view which show 4 related nodes based on category. Issue is that there is an entity reference product_group, in the node, and I want to show only those nodes which are not in product_group reference field.

This only involves one content type.


texts: Is there a way sort View by results of "Options" Rate/Voting API widget?

texts:
I'm using the Rate module to allow voting on whether or not a given node is "Helpful" or "Unhelpful". I have a view with all nodes of this type, and the view includes a field for the Rate widget. I am having no problems displaying the widget itself, and the voting is working perfectly. However, I cannot for the life of me get any type of sorting functionality to work.

I've tried all of the sort types having to do with Vote, and all of them sort the nodes in no relevant order. It seems that the problem arises because I am using the value-type of "Options", and suggestions that I have found seem to require the value-type to be "Points". However, I'd much rather have user select between "Helpful" and "Unhelpful" than to use a thumbs up/down or +/- system of voting.

Does anybody know how I could sort by "most helpful" and "most unhelpful" and keep the value-type of "Options"?


texts: Use a file token for directory path when uploading a file via core file upload field?

texts: Is there a way to use a token like [file:fid] when using the file upload field? I either want to use this, or, use the node id it is attached to with [node:nid]. It looks like I can only use global tokens, which are not unique enough to the way I want to store the file on the server.


texts: Replace username with unique hash when users delete their own accounts

texts:
When users delete their own accounts (with the core function), I don't want the username to be replaced by anonymous, but with a hash string, for example anonymous-dhjf4ued.

I tried doing it with the Rules module, and I looked for modules that could do it, but I couldn't figure it out.

The reason this would be useful is because I have sites with a forum and threads are much more readable if you can still identify which users are the same (who responds to who) if there are two cancelled user accounts in a single thread.


texts: How do I display a summary page after finishing a multistep form?

texts:
I have a multi step form in Drupal 6, and I want to show a summary page based on entered information in the steps after finishing the steps and user click finish button.

I am using the ctools wizard for create the multistep form.

How can I achieve it?


texts: How to use the gallery formatter settings in a display suite code field?

texts:
I am using the gallery formatter module to format photo galleries.

To satisfy a requirement I need to create a Display Suite code field that displays the list of pictures attached to a related node (attached through the Entity reference module).

The get the field_gallery containing images of the related page I use the following in the code field:

<?php
    $relatedNode = node_load($entity->field_related_page['und']['0']['target_id']);
    $field = field_view_field('node', $relatedNode, 'field_gallery', array( 'label'=>'hidden'));
    echo drupal_render($field) ;
?>

However this only displays a raw list of images. I need this list of images to be fomatted by the gallery formatter.

The formatter should be passed to field_view_field() as an array (instead of array( 'label'=>'hidden')) but how can I get the list of key->values that fill the array?


texts: Apply grouping to custom views list template

texts:
I have a custom views-view-list.tpl.php template that uses

foreach ($view->style_plugin->rendered_fields as $delta => $item)

to manipulate the fields at this template level rather than using

foreach ($rows as $id => $row)

and relying on views-view-fields.tpl.php to render the HTML.

However, when using grouping in a view, the views-view-list.tpl.php is called once for each grouping, but the first method renders all items, rather than just the ones in the current grouping.

How can I tell from views-view-list.tpl.php which items belong to the current grouping?


texts: How do I add a custom field in the toolbar?


texts: How can I rename the "Add Row" text on the button inside TableField

texts:
I'm using the TableField module to allow users to add themselves as entrants to a running race.
I'd like to change the standard button text from "Add Row" to "Add Entrant".
I've pretty much zero Drupal development experience with regards to hooks and APIs and PHP however I'd like to know the best approach.
Option 1.
Do I use something like hook_form_alter() (like this:
[https://drupal.stackexchange.com/questions/82106/how-can-i-change-the-add-to-cart-button-text-on-specific-product-forms]
Option 2.
TableField\src\Element\Tablefield.php
change:
'#value' => t('Add Row'),

to
'#value' => t('Add Entrants'),

I'm guessing this is a bad idea as any update to TableField could overwrite it.  However it seems a quick and dirty method which does actually work, so I'm tempted!


texts: Import LinkedIn data (profile information) to user profile in drupal

texts: I want to authenticate via LinkedIn and, after successful login, import basic user profile data into the Drupal user profile. We're currently looking into LinkedIn Integration Module.  Unfortunately this module doesn't have a strong support or new developments going. Are there alternatives?


texts:
I have a site using Drupal 8.4.1 with all core language modules enabled, 3 active languages, and where English is the default language. The pager labels (e.g. "Last »") for my own views aren't translated, although the string "Last »" is available in the translation page. I can manually translate the pager labels by adding a translation for the whole view and then overriding the pager labels, but I think this isn't the right way to do it because the built-in views (e.g. /admin/content) are  translated just fine, without any manual override.

How can pager labels be translated without manually adding the translation?


texts: Migrate two user fields (translation) to translation

texts:
I'm trying to migrate two user fields in Drupal 7 (name in two languajes) to a translated field in Drupal 8.
I have tried several options but all failed.
I have two yml templates (one for the user and another for the translation with parameter translations:true) but not working.
The user is migrated correctly.
The translation of the user is created correctly.
The field of the user is correctly but the translated field is not translated.

These are a part of the yml files...

migrate_D7_user.yml

source:
  plugin: d7_user
process:
  uid:
    -
      plugin: get
      source: uid
  name:
    -
      plugin: get
      source: name_english
  langcode:
    -
      plugin: default_value
      default_value: en
destination:
  plugin: 'entity:user'

migrate_D7_user_translation.yml

source:
  plugin: d7_user
  translations: true
process:
  uid:
    -
      plugin: migration
      source: uid
      migration: migrate_d7_user
  name:
    -
      plugin: get
      source: name_spanish
  langcode:
    -
      plugin: default_value
      default_value: es

destination:
  plugin: 'entity:user'
  translations: true

Thank you in advance,
Juanjo.


texts: Best way to store custom values in Drupal 7?

texts:
Is there a good (recommended) way to store custom values in Drupal 7? I've looked into variable_set / variable_get, but then read a comment suggesting NOT to use those for the purpose that I'm needing (unless I completely misunderstood). Here's the comment that I'm referring to:

http://api.drupal.org/api/drupal/includes!bootstrap.inc/function/variable_set/7

"All data created by variable_set() is loaded from the database at bootstrap. Calling variable_get() doesn't perform the database request to get you the data, it simply declares the $conf global and returns the variable you've asked for. Therefore, don't carelessly use variable_set() to store lots of data that you will only use on individual pages or in custom methods. Use your own little table and storage functions for that."

Basically, I'd like a place to store a couple of values, so that I can avoid having to hard code those values within my custom module code. For instance, I'd like to store a current Reporting Year (i.e. 2011), and a current Data Entry Year (i.e. 2012). Is this just something that I'd need to create my own table for?


texts: Don't show a field when a more important field is shown in a View Drupal 7

texts:
On my homepage blog messages from the users are shown. When a user adds a Youtube movie and/or one or more pictures these are shown as a preview.
The thing is though that when a user picks a movie and one or more pictures the home page message show the Youtube movie and the picture. But when both are added to a blog message I only want to see the youtube preview, so Youtube is more important than the picture so the picture should not be shown.
When there are only pictures 1 picture is shown (this works fine).
How can I change something in my View to make it prioritize Youtube over the picture so it doesn't the picture when there is a Youtube movie.

Screenie of what I have now, so the picture has to leave:
http://imageshack.com/a/img844/1833/bqer.jpg

I have a multisite setup with 11 websites so the easiest solution is welcome :)

Thanks in advance!


texts: Change the img markup using custom image effect

texts:
I want to change the markup of all the images that are using my custom image effect which I've added using hook_image_effect_info.
I've added a callback function and I managed to to accomplish the above, altought the image dimentiones are NULL.
Why are the dimentions empty? Is there a better way to change the image markuup according to the image effect?


texts: How do I programmatically add a field to a Commerce Line Item?

texts: I'm running Drupal 7 and Drupal Commerce 1.4. I need to programmatically create a simple text field on Line Item of type Product. Any idea how to do that?


texts: How to set order of Grouping Field in Format Settings

texts:
I'm on D7. I have a taxonomy "projects". A project can be "ongoing" or "completed. I currently have a view that get's all projects (projects are a taxonomy/vocabulary). The "ongoing" and "completed" are project types which are also a taxonomy/vocabulary.

In the view, I set Grouping field Nr.1 to Taxonomy Term: Project Type

I want to make sure that "ongoing" is above "completed". How can I do that? Somehow the order changed from "ongoing, completed" to "completed, ongoign" after I updated an ongoing project to completed.

The order of the taxonomy terms seem to not matter.


texts: Local install of live site looks different

texts:
Localhost site looks different than live site.

Drupal 7.37 > 7.5 (Commons), viewed in Chrome on Mac OS X.

Prep Steps:

installed a clone of the website from an outdated repository on my local machine
reconciled the code differences between the live site and the slightly outdated repository site
imported a current copy of the database from the live site.
featurized database configurations
updated most of the modules as well as Drupal core.
checked default theme and settings to make sure they are the same between sites

After noticing the problem:

downloaded theme files into respective locations
installed stage_file_proxy on local dev to load any files I ignored

Thematic Differences

From the moment I imported the database, until now, after all updates have been performed, there is a thematic difference between the live site and my local version. (The difference is slight, but annoying.)

live site is centered and contained, local stretches all the way across in some places but stays left aligned in others
some fonts are larger on local site
navigation menu splits itself to a new line early
live site has blocks on the right, local has one column with blocked content at bottom

Summary of Question

Is this a commonly known problem when certain steps are forgotten and is there another place to address configuration besides in the codebase and the database or is this probably not a theming issue but something else?

Update: I pushed the site up to my remote dev server anyways, to see if the problem was environmental or database and codebase. The remote dev looks perfect. There is definitely an issue with my local dev environment causing this somehow.


texts:
i have events page on my Drupal and it is showing events until the relative date (is greater than) "now" which means the event disappears from the table on the starting date of the event.

Can you please help me with setting that date to the last day of the event - so that the event stays on the table until the last day. I have multiple events, so i really dont know how to do this. I checked other relative formats, but i am no developer, so i am puzzled.
Thank you in advance.


texts: How to create a page with all the nodes of a specific user?

texts:
My users' profile pages contain a View with their 4 latest nodes. I would now like to add a "more" link underneath that View that redirects visitors to a page with all the nodes of that user.

I can easily create a View with all nodes of a specific user, but I don't know how to generalize this and create a page for every user. Am I making things too complicated? Maybe this is a triviality, but I can't find a solution on the internet...


texts: Using hierarchical select to display a particular section of content

texts:
I have a content type called "Results" that displays the results of a particular game.  I am using the Hierarchical select module for my taxonomy terms that include Year, Game and League.

My goal is to create a view that only displays a Result content type that matches the terms selected in the exposed Hierarchical Select module.  I currently have the view working, but it is displaying all the Results content type.


texts: Responsive Grid View appearing in single column

texts: I'm trying to create a responsive views grid. I installed the the Views Responsive Grid module. The problem is when I select that option the images appear in a single column instead of appearing in the specified columns. How do I fix this?


texts:
I am using field image to insert image into article.
The image can't show in article body.

How do I insert the image into article?


texts: Cannot do a `composer install` even though my minimum stability is listed as dev

texts:
I am trying to build the master branch in my project after updating to 8.5.0, but am being met with an error from composer (which I did not get on my develop branch):

  The requested package drupal/focal_point 1.0.0-beta6 is satisfiable by
  drupal/focal_point[1.0.0-beta6] but these conflict with your
  requirements or minimum-stability.

In my composer file, I have:

"drupal/focal_point": "^1.0",

as well as:

"minimum-stability": "dev",

How can I fix this so TravisCI gets unstuck? It worked fine for the develop branch, and the master is now updated with it.


texts:
I have a page to do this:

Boats/
Boats/Veterans
Boats/Nine
Boats/Used

Where ['Veterans', 'Nine', 'Used'] would be the parameters passed into the URL!
I would like to use my page customize

  page--boats.tpl.php

This is a page theme. Currently, I have a white page.

How can I do?