texts: Drupal 7 website layout/styling breaks all a sudden (random), how to debug? there are no logs

texts:
One of my websites running Drupal 7 goes out of format, most often when user login.

This is how it should be

After running out of format this how it looks

This may be a CSS issue, it may be a caching issue, or it may be something else. As I know Drupal core code is almost perfect but contributed, custom modules and themes can spoil something by adding bad code.

After spending sometime doing research I come across many question and answer which were not that clear at all because there are many factors that can cause such a problem therefore it is really hard to say what is happening specially in some cases when there is no sign of error or warning.

For example in my case I am using Drupal7, Superfish menu  and following modules

addressfield, addressfield_staticmap, admin_views, ajax_register, auto_nodetitle, autoassignrole, backup_migrate, captcha, ckeditor, colorbox, content_access, css_injector, ctools, currency, custom_search, date, entity, entity_translation, faq, field_collection, field_permissions, field_slideshow, flexslider, flood_unblock, follow, galleria, gmap, google_analytics, i18n, i18nviews, image_captcha_refresh, jquery_update, l10n_update, lang_dropdown, languageicons, libraries, link, Location, login_destination, markup, menu_block, mlpanels, modal_forms, money, mortgage_calculator, page_manager_redirect, panels, pathauto, real_estate, realname, rules, select_translation, serial, simple_fb_connect, simple_gmp, simpleads, simplify, smart_ip, social_share, superfish, tablefield, tabtamer, taxonomy_acces, taxonomy_acces_fix, taxonomy_csv, token, translation_overview, unique_field, user_role_field, variable, viewfield, view, view_bulk_operation, views_content_cache, views_data_export, views_field, views_horizontal_slider, views_jqfx, views_jqfx_Cycle, views_php, view_Slideshow, views_slideshow_galleria, workspace, wysiwyg

The website is hosted in Cpanel

Itry may options to look for the error and identify the problem which where not helpful at all, I tried Mozilla browser and Firebug and there is no error or warning at all. I tried to add parameters into setting.php

error_reporting(-1);
$conf['error_level'] = 2;
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

And still nothing changed. finally I decided to post the question here and ask all the great and genius developer to post their view and solution on:

What can cause a Drupal website to run out of format and broke the layout
What are the available tools or option that we can use to debug a Drupal

Can anyone please explain how to debug Drupal and deal with theme issue  in a step-by-step way to make it simpler for everybody?


texts:
I'm looking for a module, where I can exchange the normal node reference output in a node's edit form as a view (preferably with the table design).

Kind of like the Reference Views, but for edit forms. Does anybody know a module like that?


texts:
I want to display a custom field, and i've done it with this code

<?php
 global $user;

 $user_fields = user_load($user->uid);

 $customfield = $user_fields->field_navnn['und']['0']['value'];

 print  t("Custom field value is " . $customfield. ' ') ;
?>

but it dosn't show when im logged out.
Thanks


texts: How can I get the parent term in a taxonomy with a hierarchy?

texts:
I have a node that is tagged with a taxonomy term which is part of a hierarchy of terms such as "state >> county."

As the user has selected one of the "county" tags, how can I get the name of the parent term?


texts: General Approach in Zen-Theming: 3 different fixed-width layouts based on viewport-size

texts:
I am building a zen-subtheme which should have 3 breakpoints depending on viewport-size, but none of the layouts has sidebars, there is a small horizontal navigation for all layouts.
By default, Zen provides a responsive-sidebars.scss and fixed-width.scss - since i need media-queries on one hand but no fluid sidebars etc. on the other hand, i don't know, what's the best way to go.


texts: Best way to keep customized ckeditor library up to date

texts:
Background
A D7 site I am working on uses wysiwyg module with ckeditor library.
(I know there is a dedicated ckeditor module, but we want to stick with what we have on this existing website.
The library was downloaded with a customized list of plugins, I assume using the online builder at https://ckeditor.com/cke4/builder.
The download contains a build-config.js which can be uploaded to the builder to define which plugins should be installed.
The builder always produces the latest version.
The builder has the option for a non-minified version, but then the wysiwyg_ckeditor_version() version callback is unable to determine the version.
Plugins can be added in two ways:

by adding them to the customized  download, which not only adds js files for the plugin, but also changes the main ckeditor.js.
by downloading the additional plugins manually, and then adding some custom js with
CKEDITOR.plugins.add(...). We are already doing this for some 3rd party plugins that are not available from the main ckeditor website.

Problems
By using this download method, whenever we want to add an additional plugin in the "simple" way (by adding them to the download), we are forced to download the latest version of the ckeditor library. There are ways to download earlier versions, but not with all the plugins.
This then also requires to download the latest version of wysiwyg module, because an older version of the module might not be compatible with the latest library.
There may be good reasons to do this (e.g. security), but it would be preferable if these two steps were separate.
Having access to an earlier version would e.g. allow to identify regressions caused by a specific update.
Also, downloading in this way requires to add the downloaded code in the project's source control (git), instead of downloading it on deployment.
Question
Is there a better way to download ckeditor and manage the plugins, translations, choice of skin?
E.g. using npm?
I found https://www.npmjs.com/package/ckeditor4, but how far will this get me in combination with the wysiwyg module?
Or using the CDN, like the dedicated ckeditor module does?
Does this allow to specify which plugins to add?
And can this be made to work with wysiwyg module?
I might be able to figure this out for myself, but perhaps there is already a documented recipe somewhere, or somebody already tried this and can share their experience.


texts: Calling entity reference field in page template

texts:
We are working on Drupal 8 Blog Page template. We want to render entity reference fields in the page template.

I have tried {{ node.field_name.entity.name.value }} and {{ node.field_name.entity.uri.value }} but none of this is working. Do I need to update/change anything in Drupal backend for the content type?


texts: Getting custom body class from node field

texts:
I would need to get a custom body class, so that admin can set the class. At the moment I have field on page node type where I try to get it. The code what I have is below but it doesn't seem to work that smoothly. Something it prints two body classes (like this <body class="classes comes here" class="another set of classes">) It's in template.php and preprocess_html function.

$node = menu_get_object();
if ($node && isset($node->nid)) {

    $field_bClass = field_get_items('node', $node, 'field_bClass');

    if (!empty($field_bClass)) {
        $field_field_bClass_output = field_view_value('node', $node, 'field_bClass', $field_bClass[0], array(
            'type' => 'value'
        ));

        $vars['classes_array'][] = $field_field_bClass_output['#markup'];

    }
}

Is that corrrect and what should be done difrently?


texts: Getting Node Field Values from Referenced Entity within a Paragraph

texts:
I'm trying to create a featured content paragraph type, however, I can't figure out how to grab anything from the referenced node that is in my entity reference. I don't see any twig documentation that covers this seemingly crucial task at all either.

Does anyone know of a way to call something like get_node() within a twig template?


texts: Programmatically adding fields to specific vocabularies

texts:
Is it possible to add fields to vocabulary terms programmatically in a custom module?

I know it can be done at admin/structure/taxonomy/news_client_sites/fields in the UI, but I'd like to add the fields during the module install process.

I have specific vocabularies I've created during hook_install, but I'd like to be able to add fields to them as well.


texts: How to disallow node authors to change node content if comments were submitted for that node?

texts: On my site we have enquiries (nodes) and price offers (comments). So if there's at least one price offered (a comment submitted) the enquiry details (node) shouldn't be changed. Is there any way to do that?


texts: How to make changes to the database schema?

texts:
I am trying to follow edits made in a php file to patch a module  and the instructions just say "In your database schema add this", which I could do if I knew where to find the file. When I look up drupal database schema it shows a map which doesn't help me to find the file. What do they mean exactly by in your database schema and how can I access this file in terminal? Is it by editing a table in the database?

I can find the other file alright to edit in /includes/database/mysql/schema.inc file but just not the specific module one.

The instructions for this vchess module patch are here


texts: Is it a security issue to put CSRF token in drupal settings?

texts:
I have an application where I created a REST resource to update a field on the user object to store bookmarked items.

When you do a post request to a rest resource you are required to use a header with X-CSRF-Token.

You can get this by making a call to "/session/token".  But I'm wondering if it's OK, if you have a "bookmarks" widget on all pages to include the token in drupal settings.

Or is this some kind of security issue?

Is it better to make a call through javascript to get the token, rather than have it in the drupal settings?

Or as long as you're logged in, having the csrf token in drupal settings is not a problem?

/**
 * Implements hook_preprocess_HOOK().
 */
function mymodule_preprocess_page(&$vars) {

  // Add CSRF token to page for authenticated users.  Token
  // is required by rest resources on POST requests.
  if ($vars['logged_in']) {

    $route = \Drupal::routeMatch()->getRouteObject();
    $is_admin = \Drupal::service('router.admin_context')->isAdminRoute($route);

    if (!$is_admin) {
      $vars['#attached']['drupalSettings']['user']['csrf'] = \Drupal::csrfToken()->get(CsrfRequestHeaderAccessCheck::TOKEN_KEY);
    }
  }
}


texts: Is it possible to use a sort of constant or a custom token in the rewrite section of a views field?

texts:
My use case.

I have a portion of a URL of another site (www.example1.com) under each of my nodes (let's say node type B).

Each of these nodes can be related with another node (let's say node type A).

I need a view which show informations of A nodes and get the URL portions from B nodes using the relationship section of the view.

That's ok, I get what I want but I would like to create a URL with this URL's portion adding a constant/token at the beginning (www.example1.com) so that it can changed in a simple way (let's say www.example2.com) instead of modify each field of the view.

My best bet should be probably to rewrite the template of the view and using a constant (variable_get/set should be fine) but I would like to have this field configurable with the UI.

Thanks


texts: How to display the username instead of the UID?

texts:
I created a view to display content in a table. I want to show the author of the last comment.
So I added the field "Comment Statistics: Uid of the last comment", but I wish to have the username in place of the UID.

How to do this ?


texts:
I've propagated the 3rd party PHP SDK for Facebook APIs using Libraries and I've also enabled X Autoload but still I'm getting this error

  Parse error: syntax error, unexpected 'use' (T_USE)

Below is my code:

/**
 * Libraries API 2
 */
$facebook_library = libraries_detect('facebook-php-sdk-v4');
// This statement is TRUE
if ($facebook_library['installed'] == 1) {
  require(libraries_get_path('facebook-php-sdk-v4') . '/autoload.php');
  use Facebook\FacebookSession;
  use Facebook\FacebookRequest;
}


texts: Mobile Tools detects mobile and iPad, not Android tablet

texts:
I have used the Mobile Tools module for Drupal 6 to distinguish between mobiles,tablets and browsers. I am not using themes, just provided the redirection urls from the drupal admin settings.

The aim is  to redirect to mobile site while accessing from mobile(mysite.com/mobile).
Must redirect to the existing site while taken from tablet and web browsers(mysite.com).
It works fine for iphone,andorid mobile,blackberry and iPad.

But it redirects to mobile site when taken from Android tablet while I need to redirect to the desktop url.

Can anybody suggest how can I handle the android tablet using mobile tool so that it does not get redirected to mobile site?


texts: How would I make a search view display results in a new page instead of on the same page?

texts: I have view (a block) that searches my products for various fields such as sell price, title, ect. It works except all the search results appear right in that block instead of on a new page. Here is an example of what I want to do: http://www.themesdojo.com/drupads/


texts: Aegir no longer seems to be adding SSL info to apache config files for sites

texts:
I am using hostmaster 7.x-3.171 and I am using the legacy SSL option (apache SSL - not apache HTTPS)

When i check the apache entry for the site in question at

/var/aegir/config/server_master/apache

it is missing the 443 entry and only has an entry for port 80 stuff.

I have double checked the site settings in aegir and SSL is enabled and a certificate is selected. I have tried to verify the site and no errors are presented. This seems to happen only if I try to verify a site that has SSL enabled. Maybe an update broke this somehow? I haven't done anything to mod the aegir set up that i can think of.

Has anyone had a similar problem recently in aegir? Any help would be appreciated!


texts: How to patch core via drush-make when using a stub make file?

texts:
When using a stub make file based profile workflow as suggested in Drush Make theory for happy profile development I notice that patches to core are no longer applied.

I've tested this by reverting to a single make file workflow - core patches get applied just fine that way.

Has anyone else found a fix/workaround for this?

UPDATE with details...

Here's what my stub make file looks like:

api = 2
core = 7.x

projects[] = drupal

projects[example_profile][download][type] = "git"
projects[example_profile][download][url] = "git@github.com:danohea/example-profile.git"
projects[example_profile][type] = "profile"

Which as you can see is designed to go grab a custom profile. I should mention that that is not the real path to the profile (which is a private repo anyway).

The profile contains a further make file that looks a bit like this (shortened for convenience):

api = 2
core = 7.x

; Contrib modules (not in dev)

; Specify common subdir of "contrib"
defaults[projects][subdir] = "contrib"

projects[admin_menu][version] = 3
projects[ctools][version] = 1
projects[diff][version] = 3
projects[eck][version] = 2
projects[entity][version] = 1
projects[jquery_update][version] = 3
projects[libraries][version] = 2
projects[link][version] = 1
projects[module_filter][version] = 2
projects[pathauto][version] = 1
projects[token][version] = 1
projects[transliteration][version] = 3
projects[views][version] = 3

; Contrib modules (in dev)

projects[wysiwyg][version] = 2.x-dev
; Keep in dev until this issue makes it to stable:
; https://drupal.org/node/1956778

; Themes

projects[omega][version] = 4
projects[omega][subdir] = "contrib"

; Libraries

; ckeditor
libraries[ckeditor][download][type] = file
libraries[ckeditor][download][url] = http://ckeditor.com/builder/download/a63002d0b001ab7841c8e29bb8081e57

; Patches

; drupal
; Ignore front end vendor folders to improve directory search performance
projects[drupal][patch][2329453] = https://www.drupal.org/files/issues/optimize_scan-2329453-84-do-not-test.patch

; pathauto
; Merge in pathauto_persist module functionality to prevent losing manual aliases with node_save() calls
projects[pathauto][patch][936222] = https://www.drupal.org/files/issues/merge_in-936222-299.patch

The stub make file is run with a command that looks a bit like this:

drush make --prepare-install path/to/stub.make -y

I'm running Drush version 7.0.0.

Note that there are 2 patches, one for drupal core and one for pathauto. The pathauto one is applied as expected, the drupal one doesn't seem to even run.

If I download & run the profile's make file directly (i.e. not via the stub) then the core patch is applied as expected.

If I move the drupal core patch to the stub make file, it still doesn't run.


texts: Fatal error undefined function taxonomy_get_tree()

texts:
I want to write a module that makes a select search form based on taxonomy terms. (with hierarchical select boxes)
This is on drupal 7.0 and status is up to date.
The form is made and Ajax is properly working with testing values.
But now I need to find a way to fill up my select boxes with taxonomy terms,
wanted to use the function taxonomy_get_tree (modules/taxonomy/taxonomy.module, line 836) and received the message:

Fatal error: Call to undefined function taxonomy_get_tree()

When I've put the function from modules/taxonomy/taxonomy.module in my own module I receive the message:

Fatal error: Cannot redeclare taxonomy_get_tree()

Should it be that I have to hook my module in any kind of way with the taxonomy.module file, or ar there other ways to achieve my goal?

This is on a mymodule.module file placed in drupal7/sites/all/sitename/modules/custom/mymodule/mymodule.module

The code is like

$tree = taxonomy_get_tree(6, $parent = 0, $max_depth = NULL, $load_entities = FALSE);
print_r($tree);

I'm unable to approach all functions in the taxonomy.module page...


texts:
I'm creating a simple contact form and it works flawlessly, besides the validation.

When I try to exercise the validate function, no error messages are shown. The text in the correspondent field turns red, so that works, but where is the messages?

If I fill in the form correctly and the mail gets sent, messages are shown just like they should.

Here's my code:

function mymodule_buysell_contact_form($form, &$form_state) {
    // The form

    $form['contact'] = array(

        '#title' => t('Skicka ett meddelande till säljaren'),

        '#type' => 'fieldset'

    );
    $form['contact']['message'] = array(

        '#type' => 'textarea',

        '#title' => t('Meddelande:'),

        '#cols' => 35,

        '#rows' => 6,

        '#resizable' => FALSE

    );
    $form['contact']['name'] = array(

        '#type' => 'textfield',

        '#title' => t('Ditt Namn:'),

        '#size' => 35,

        '#maxlength' => 30

    );
    $form['contact']['compname'] = array(

        '#type' => 'textfield',

        '#title' => t('Företag:'),

        '#size' => 35,

        '#maxlength' => 30

    );
    $form['contact']['phone'] = array(

        '#type' => 'textfield',

        '#title' => t('Telefon:'),

        '#size' => 35,

        '#maxlength' => 30

    );
    $form['contact']['cellphone'] = array(

        '#type' => 'textfield',

        '#title' => t('Mobiltelefon:'),

        '#size' => 35,

        '#maxlength' => 30

    );

    $form['contact']['mail'] = array(

        '#type' => 'textfield',

        '#title' => t('Din E-mail:'),

        '#size' => 35,

        '#maxlength' => 30

    );

    $form['contact']['captcha'] = array (
        '#type' => 'captcha',
        '#captcha_type' => 'image_captcha/Image',
    );

    $form['contact']['submit'] = array(

        '#type' => 'submit',

        '#value' => t('Skicka')

    );

    return $form;
    }

    function mymodule_buysell_contact_form_validate($form, &$form_state) {
    // Validate message

    $valid_message = $form_state['values']['message'];

        if (empty($valid_message)) {

        form_set_error('message', 'Du har inte skrivit något meddelande');

        }
    // Validate if a name is submitted

    $valid_name = $form_state['values']['name'];

        if (empty($valid_name)) {

        form_set_error('name', 'Du har inte fyllt i ett namn');

        }

    // Validate if a company name is submitted

    $valid_compname = $form_state['values']['compname'];

        if (empty($valid_compname)) {

        form_set_error('compname', 'Du har inte fyllt i ditt företagsnamn');

        }
    // Validate phone by look for numbers

    $valid_phone = $form_state['values']['phone'];

        if (!is_numeric($valid_phone)) {

        form_set_error('phone', 'Ditt nummer verkar inte vara korrekt ifyllt (endast siffror)');

        }
    // Validate cellphone by look for numbers

    $valid_cellphone = $form_state['values']['cellphone'];

        if (!is_numeric($valid_cellphone)) {

        form_set_error('cellphone', 'Ditt mobilnummer verkar inte vara korrekt ifyllt (endast siffror)');

        }

    // Validate the mail, using Drupals own function

    $valid_email = $form_state['values']['mail'];

        if (!valid_email_address($valid_email)) {

        form_set_error('mail', 'Din Epost verkar inte vara korrekt ifylld');

        }
}


texts: Negative number of stock after order many products

texts:
I have a website made using Drupal 7 and Ubercart 3.6, and with the uc_stock module.

If client is adding to cart product qty more, then set in stock level that is doesn't generate any errors or notices. And stock level is decrementing to negative number, see screenshot:

Is it possible to disable Negative number of stock level?


texts:
I'm having an a field set as unlimited in the options in my custom content type, whenever I'm clicking on "Add another item" the page is only loading AJAX and I'm getting this message in error log :

  Notice: Undefined index: #ajax in ajax_form_callback() (line 391 of /var/www/html/includes/ajax.inc).

Note: Though I haven't saved/updated the product there is also a message in dblog that node has been updated. This issues was not their previously until I updated my drupal version from  7.22 to 7.32 using drush


texts: Get content types field in another content type with the entity reference relationship

texts: I have two content types. Person and Projects. I use a entity reference for the persons name on the project node so people can select the person that is involved in the project. Now using that reference I also want to get another field from the persons content type, and display this. I can't figure out how to do this. I thought I could do it with a views. I created a view with a relationship and filter with NID but it just doesn't seem to work. Whats the simplest way (view or not) to do this?


texts:
I am using Drupal 7 and unfortunately there are problems with the calendar module. The calendar itself is used in a relatively small enviroment of 20-40 users, which are all registered userers with permanent accounts.
The problem is the more appointments I add to the calendar, the slower the whole
calendar gets. It seems the problem is related to the dateobject, which can be seen in the following screenshot, which displays the parsing between the objects:

I don't know why there are like 15k calls, if I roughly have 50-300 appointments.

Does anyone know this problem or has suggestions how to solve it? I also tried to cache the calendar, but that does not work at all.

Thanks in advance.

Comment:

I just figured out the problem lies within repeating dates. If I for example create a Date that repeats itself each week on monday 100 times Drupal always loads ALL of these events, even though there is just 1 of 100 of these events, in the month my view currenly shows.

Maybe someone knows a way to change that, so it just loads the dates which occur in my current instance of the view?

Please help.

As demanded a full view:

I defnitely cornered the problem on the reapeating events in my calendar. If I reduce them, the latency is fine.


texts: Services node retrieve -> Access restriction

texts:
I am currently working on a project where i am exposing some nodes from a specific content type via services.
For the scope of the project I only allow retrieving of nodes from that specific content type.

I am wondering what the safest way would be to make sure that user can only try to retrieve nodes of that specific content type (or some other additional parameters [for example: only nodes that have a specific taxonomy term selected].

I started of creating a method that validates the received json object on the content type that is received.
But this does not feel like the safest way, since people can intercept the response before i get to validate it (correct?)

But it also feels like overkill to create a services view / create a custom resource just for this?

Many thanks for the opinions!


texts: Problem with the author of a node revision and the Revisioning module

texts:
I am using the Revisioning module for Drupal 6. When administrator users accept the node revision, the author name is changed to anonymous user.

Why does this happens?


texts: How to pass an argument into Views for Drupal 7?

texts:
I'm trying to pass an argument through a block created by a view.

The node is an ubercart product node. I have aliased the paths such as:

node/45 to products/[name]

In contextual filters, I've chosen the filter "Content: Nid"

In the Preview with contextual filters it works with the node id as it should. e.g. "45" but the view doesn't show on the page node/45.

I believe the alias may have caused the problem, but I thought Drupal was designed to have aliases converted to node id's.


texts:
We used i18n module to have our nodes as translatable.
However we also themed a specific nid with e.g node--9.tpl.php.

Problem is that i18n creates separate nodes(this separate nids), for each translation language, thus the theme file only applies to 1 version of that particular node.

How can I handle this?


texts: how can I share profile information that needs to be shared by website_one with website_two

texts:
Consider there are two websites

website 1
website 2 (site done by Drupal 6)

Now, i need to do the following thing mentioned below:

Profile information that needs to be shared by website_one with website_two

How can i achieve this.

I know that it is difficult to answer this question.

If possible kindly provide me any URL's or examples or any tutorials that should help to complete the process.

Any help will be thankful and grateful.

Thanks in advance..


texts: I need to add a date to a calendar without creating a node

texts: I have a difficult use case. I am building a site for a beverage distributor. They want to put their sampling events on a calendar. The problem is the sampling events don't really have a title. They just have the beverage being sampled, the location, and the date/time. Is there a way I can add dates to a calendar without creating a node for them or create a node with no title field?


texts:
I have a list of items that I need turned into a taxonomy. My list looks something like this:

Apple
    Apple 1a
    Apple 1b
    Apple 2a
    Apple 2b
    ...
    Apple 192b
Banana
    Banana 1a
    Banana 1b
    Banana 2a
    Banana 2b
    ...
    Banana 96a
....
More Items
    More Items 1a
    ....
    More Items 300b

Anyway you get the idea. Creating new terms for each of these isn't going to work in this case , it'll take days. Is there any way to bulk create from a text file like this?


texts: Setting author when creating a new node via Cron

texts:
I'm creating a new node using hook_cron(). It all works except the node author is always set as anonymous (uid = 0). How can I assign a user to the new node, with say uid 21 for example?

Below is the node creation code that I have in a function that gets called within hook_cron().

$node = new stdClass();
$node->type = $type;
$node->title = "Some node title";
$node->language = LANGUAGE_NONE;
$node->uid = 21;
node_object_prepare($node);

$node->body[$node->language][0]['value'] = '';
$node->body[$node->language][0]['summary'] = '';
$node->body[$node->language][0]['format'] = 'html_text';

$node->field_quote[$node->language][0]['value'] = $some_value;
$node->field_quote[$node->language][0]['format'] = 'plain_text';

$node = node_submit($node);
node_save($node);

Even though I state $node->uid = 21;, it always results in an anonymous author.


texts: View To Show Tagged Comments Via Arguments

texts:
Hello i like how you can add taxonomy to comments now in D7. Im having a few problems though creating a View that will take a tid contextual filter and show the comments in the taxonomy page as a block. Has anyone managed to achieve this?

Thanks


texts: How to share menus and blocks across domains, but not users and content data?

texts:
I'm trying to create multiple sites(maybe over 20 sites) using the same menu and some blocks, but not others.

I found these modules that have very similar features/functions:
- Domain Access.
- Domain Menu Access.
- Domain Blocks.

However, I don't want to share the users, content and other data.

Also, for each of the domain, I would like to have their own Drupal backend.

What is the easiest and effective solution?


texts: Get paths of files attached to the node from field name

texts:
How can I get the paths (URLs) of files attached to the node from field name in Drupal 8?

I tried using Drupal 7's node_load(), but that does not return paths of the files:

$node = \Drupal::routeMatch()->getParameter('node');
$node = node_load($node->id());
var_dump($node);


texts:
Somehow I cannot get the result I want. I have a view that produces a page and I am offered to have this as a menu item in menu of my choice. But what I actually want to achieve is to nest it as a menu item of a MENU ITEM of main menu, such as in:

[main menu] > Downloads > PDF Diagrams

Is that possible at all?

Artur


texts:
Pattern for taxonomy terms is [term:parent]/[term:name] where car is parent and BMW is child

Path is looking like this when I am on child term page:
www.mysite.com/car/bmw

In menu I have link to /car and when I am there it displays a list of all child terms. Thats fine.

But when I generate XML sitemap I see /car/bmw (all good), but for strange reason there is link taxonomy/term/1 and which leads to page without any content or terms in it, while it should redirect to /car.

There is no /car link found.

To avoid duplicate content I am not sure how to avoid this. I tried recreating all paths bit no luck

Edit:

To elaborate in more details.
Vocabulary has several parents, each 100 childs.
Childs are displaying correctly as i have described above.
For each parent i created separate view to display several fields.
Filter is set to Taxonomy Term: Parent term. Is equal to "value", where value is taxonomy tid. Lets say that for this view value is 1 (term car)
I also have relationship with Identifier: Parent. Require this relationship is on.

Path is set to /car
Menu to Normal menu item "CAR".

When i go on homepage and click on menu item CAR everything is fine.

In meantime i deleted and bulk updated all taxonomy and now instead of getting old /taxonomy/term/1 or "/car" path for tid 1, i got "car-0".

View that is in menu "CAR" is still displaying ok, path is ok ("car"), but sitemap cant find this url but instead finds "car-0".
Going to path "car-0" displaying nothing, not the terms nor the content it is tagged with.


texts:
I am not good at CSS. Here I want to divid every grid evenly. The is my page. My view I use grid instead of table or unformatted list, which are only text on each row not suit my want.

https://www.jeffhost.idv.tw/services

The other question is on this. I found the picture too small, while making the window smaller. How to adjust a proper setting on View?

https://www.jeffhost.idv.tw/online-buying

Thanks.


texts: Contextual filter has no results when using entity translation of non default language

texts:
I have a view that shows content with an entity reference field referencing the currently displayed node.
This is a scenario often used, just a block (pane in my case) that shows content (child nodes) that belongs to the current node (parent node).

This uses the contextual filter (Content entity referenced from field_section_reference) Content: Nid
with 'provide default argument': content ID from URL'

The view is filtered with 'Field Language:Current user's language'

This works fine for the default site language, showing all content of the language (url language selection)
But when I use the language switcher, the view does not show anything any more. Translated content of current language is not shown.

I removed the contextual filter and added a normal filter, selecting manually a language other than the default site language. This worked, translated content shows fine.

If you are reading this and have entity translation enabled in a similar setup, please do me a favor and test if I'm right. I have spend quite some hours trying to find alternatives and workarounds, but can't display a view of translated content that is referencing the currently displayed node, when using a not-default language.


texts:
Drupal 6.20 according to the changelog file.

We took over a site from another company who built the site in Drupal, and we'll be converting it over to Wordpress eventually but we need to resolve the search issue first.

I get the "You must include at least one positive keyword with 3 characters or more." error message whether I use the search bar (search module) which leads you to "search/node/KEYWORD" with KEYWORD being your search parameter or if I just go to /search after the URL.

I've read about this and have tried all the suggestions that I saw and none have resolved the issue. I re-indexed the site, and ran cron.php. After I ran cron.php I looked at the settings again and it shows that 100% of the site has been indexed.

I also manually changed the search module status in the database, but it only made the search bar disappear and after I changed the status back to active I got the same result. I tried that because it worked for another module that wasn't working on startup.

The entire site and DB was copied over, and the site that is on the other company server the search functions properly. I don't think it's php version related because I ran a script to revert back to PHP 5.3. Does anyone have any suggestions on what else I might try to possibly get the search working?


texts: Import REST API web Application to Drupal 7

texts: I have a REST API web Application which is in core PHP. Now I want to change that application to Drupal 7. How to use those application in Drupal 7. I am new to REST API services..


texts: Drush not picking up rsync parameters from site alias

texts:
In self.yml I've got two site aliases defined like this:
dev:
  root: /var/www/example-dev/web
  uri: https://dev.example.co.uk
  paths:
    public: 'sites/default/files'
    private: '../private'
  command:
    core:
      rsync:
        options:
          mode: rlpgoDk

live:
  root: /var/www/example-live/web
  uri: https://example.co.uk
  paths:
    public: 'sites/default/files'
    private: '../private'
  command:
    core:
      rsync:
        options:
          mode: rlpgoDk

When I run drush --debug rsync @live:%public @dev:%public it shows that the actual command it's running is rsync -e 'ssh -o PasswordAuthentication=no' -akzv  --stats --progress /var/www/example-live/web/sites/default/files/ /var/www/example-dev/web/sites/default/files which means that most of the info is picked up from this file, but the rsync 'mode' parameter is being ignored. When I pass --mode rlpgoDkon the command line it works as expected but it doesn't seem to be picking it up from the alias settings.
Is this a bug or am I missing something?
I'm using Drush version 9.7.2 and Drupal 8.9.6.


texts: How do I prevent a menu item from appearing?

texts:
I have a View with a page display. I placed the path of that page view in a menu item. I placed this link under the menu path Primary Links > Apps > Home > Admin View.

In the View defaults section, I set two roles to be able to view the page: administrator and a custom admin role I created.

I have a user that does not have the administrator or the custom admin role. They can see the Home menu item, but they can also see the Admin View. If they click on Admin View, they receive the error "You are not authorized to access this page."

I thought that in Drupal 6 menu items do not appear unless the user has access to them. I have another View for Project Manager Admin, and my user does not see that menu item.

Does anyone have any suggestions regarding where to start debugging this problem? I would like for the Admin View menu item to not appear for my user because my user does not have access to it.

I have tried logging on as the user in question in a different browser and on a different machine, and I can still see the menu item.

Thank you!


texts: Commenting option for each paragraph of a node body

texts:
I want to provide this option that users be able to put comment on each paragraph of an article that a user has posted in Drupal.

I have applied some changes to node.tpl.php file, like

$paragraphs = explode("<p>",render($content));

so I can render each paragraph with a for loop, like:

 $number=count($paragraphs);
 for ($i=1;$i<$number;$i++)
 print render($paragraphs[$i]);

Now, I want to write a module to provide the commenting option for each paragraph. I will use hook_node_view function to define a new field like:

 $node->content['paragraphcomment']

which is similar to

   $node->content['comments']

but the new one I am defining is a 2 dimensional array. so after

   print render($paragraphs[$i]);  // in node.tpl.php

I can write

   print render($content['paragraphcommnet'].

But I need to know in which file $node->content['comments'] is defined. If anybody can help me with I would really appreciate it. Also if you think my solution is wrong, please let me know.

Thank you


texts:
The question is clear from the title itself :

I have tried :

function mymodule_form_alter(&$form, FormStateInterface $form_state, $form_id) {
          $form_state->getValue('field_p_fqdn');
          $form['field_p_fqdn']['und']['#default_value'];
}

where field_p_fqdn is my field name .But both didnt worked . Any idea ??


texts: When making a new core release, how do mantainers tag the core modules and update their info files?

texts:
When Drupal maintainers make a new core release, how do they tag the core modules and update their info files?
I have noticed that all the core modules of Drupal 7.43 have a section in their info files that looks like this:

version = "7.43"
project = "drupal"
datestamp = "1456343506"

Is there an automated procedure that runs GIT to merge branches, tag releases and updates the info files accordingly?


texts:
In my website, users will be redirected to a "frontpage" page where they will be able to see the latest news, their special announcements, their own materials, etc. Now I have to use DB to retrieve all those information.
I also want to use caching for this purpose so the data on their frontpage refresh every 3 hours let's say instead of each visit.

I am using the following function to achieve this:

function mymodule_cache($reset = FALSE) {
  static $my_data;
  global $user;
  if (!isset($my_data) || $reset) {
    if (!$reset && ($cache = cache_get('user_data:' . $user->uid)) && !empty($cache->data)) {
      $my_data = unserialize($cache->data);
    }
    else {
      $my_data = ... (This is where I do all the DB queries, etc.);
      cache_set('user_data:' . $user->uid, serialize($my_data), 'cache', time() + 10800);
    }
  }
  return $my_data;

}

now this works great, but my question is how if I have tons of users, let's say 10,000 users, would it be efficient to still using this caching method since we are filling up the table rows with data?

Or if not, what is the best solution?

Thanks
Luca


texts: Drupal 7: Filter nodes with a date range arround an exposed date

texts:
My issue is somewhat opposite of the common "List nodes within a date range".

So, I have an Event content type, with fields start_date and end_date. They show when the event starts, and when the event ends. Now I need to be able to select a date and fetch all events for which start_date < selected_date and end_date > selected_date.

The selected date should be an exposed filter to all users, or any other way that makes it possible to be fetcher from the URL.

Thanks in advance!


texts: Custom Entity is only showing via admin theme

texts:
I implemented a custom content entity with Drupal console. By default the routing is done in JobListingEntityHtmlRouteProvider.php file. I am getting a standard path such as /admin/structure/my_custom_entity/id.

I tried to use URL alias pattern to change it such as /my_custom_entity/id. That worked but still give me the admin theme upon viewing the entity. I did defined a themable custom twig template but it's not picking it up.

I also changed _admin_route to FALSE in JobListingEntityHtmlRouteProvider.php routing file. No go.

Any help appreciated.


texts: No response from Services Entity API when added '.json' to the end of alias

texts:
While configuring Services module, when I add '.json' to the end of the resource alias I get an emtpy page. Other resources that are not provided via Services Entity API output json the same way. The Services Entity API module have no documentation in this direction. Any ideas?

Edit: Also adding '.xml' gives empty response which points to that I am doing something wrong:)


texts: How can I flag (follow) user by REST API using service resources?

texts:
I am using flag module to have the following user function. So that the followers will be able to read the blog of the users that they followed.
Now I want to provide api for mobile application, when a userA go to profile of userB, they can follow userB by follow button. Is there any way to return an api by POST method in RESTfull to do like that?


texts: I need to bring a site to version control, and set up the continuous Integration environment

texts:
I am an entrepreneur with a Drupal 6x project that started small enough to not need version control (per developers), but now I am convinced there is no way without it. There's extensive documentation on JIRA, complete with well-written User Stories covering everything. I read up a bit about how this could be done and came up with the following plan -

Separate site code from database using modules

Context
Features
Strongarm
Profiler

Put the code in a SVN repository and create a staging site
Create a mirror of the staging server on EC2 production server
Create Selenium tests, and run them on the cloud using Saucelabs
Create a build workflow in JIRA Studio using Elastic Bamboo to run automatic updates
Update and install profiles using Drush Make
Run updates on production server (I am not sure how)

To begin with, I have made a list of about 50 "Features", each with its components (views, content types, modules etc). This will no doubt be challenging as the site contains about a dozen custom modules and web services, not to mention another dozen instances of content type "application" containing custom code (most of which I would like to have converted to upgradable views or modules). The good thing is that the site is not yet in production so the risk is still limited.

Does anyone have any experience in doing something similar? What pitfalls and limitations should I expect to encounter? I would greatly appreciate any suggestions for improving/correcting the above plan, or any insight or advice that you experts out there might have for me.


texts:
I've got a custom module that is sending some emails and I want to put the site name in the subject line, but whenever I look up the site_name in code, it is wrapped in html.

This is the code I use to generate the subject line:

$variables = array(
    '%site_name' => variable_get('site_name'),
    '%tags' => $params['tags'],
);

$subject = t('%site_name: Verify your Subscription', $variables);
error_log("subject=$subject");

In the email I received and in the error log, this is what $subject is:

liberalgeek.com: Verify your Subscription

Why is the site_name wrapped in html?

How can I either strip the html or lookup the site_name in a different way so that it doesn't have the html to start?


texts: Views filter of date - complicated relative format

texts:
Looking for some suggestions on how to best accomplish this. We want to set up a filter on a date field to display just content with a date within the current (or next or previous) academic year, defined as May 1-April 30.

Using the great Views between dates filter (https://www.drupal.org/project/views_between_dates_filter) we can do the filter, but the exact relative format string elludes us, and quite likely can't be achieved without writing some code.

What we have so far is a start set to "first day of may" and end set to "last day of april +1 year", but of course as soon as we hit January 1st that blows up.

Can anyone recommend a different approach or even better module that makes this happen?


texts: How to use localized date formats I've defined?

texts:
I am translating a site to French. I am using Internationalization, Entity Translation, and several other modules.

By default, at admin/config/regional/date-time, there are a bunch of date types already defined with formats selected for the default language.

I used hook_date_formats() and defined a set of analogous formats for French, and they do correctly appear at admin/config/regional/date-time/locale/fr/edit.
I set my user language to French and also changed the default country to France at admin/config/regional/settings.

My dates, in Views and in other spots, are still not translated. The only way to make them work is to manually choose the formats I want at admin/config/regional/date-time, but that changes them independently of my language and country. Am I missing something getting this to work?


texts: Custom route using access check error with arguments

texts:
I have a custom route that needs to check if a user can create a certain group_node:article content inside a group (from the group module 8.x-1.0-rc2). The setting is as follows:

mymod.routing.yml

mymod.add:
  path: '/mymod/add/{group}/{plugin_id}'
  defaults:
    _controller: '\Drupal\mymod\Controller\MymodController::addNews'
    _title: 'Add news'
  requirements:
    _group_content_create_access: 'TRUE'

The group.services.yml

  access_check.group_content.create:
  class: 'Drupal\group\Access\GroupContentCreateAccessCheck'
  arguments: ['@entity.manager']
  tags:
    - { name: 'access_check', applies_to: '_group_content_create_access' }

GroupContentCreateAccessCheck.php

 /**
* Checks access for group content creation routes.
*
* All routes using this access check should have a group and plugin_id
* parameter and have the _group_content_create_access requirement set
* to either 'TRUE' or 'FALSE'.
*
* @param \Symfony\Component\Routing\Route $route
*   The route to check against.
* @param \Drupal\Core\Session\AccountInterface $account
*   The currently logged in account.
* @param \Drupal\group\Entity\GroupInterface $group
*   The group in which the content should be created.
* @param string $plugin_id
*   The group content enabler ID to use for the group content entity.
*
* @return \Drupal\Core\Access\AccessResultInterface
*   The access result.
*/
public function access(Route $route, AccountInterface $account, GroupInterface $group, $plugin_id) {
  ...
}

From my understanding these 3 files should be enough to check _group_content_create_access. However, trying to access my route via

localhost/mysite/mymod/add/57/some-plugin-id

always results in RuntimeException: Callable "Drupal\group\Access\GroupContentCreateAccessCheck::access" requires a value for the "$group" argument.

What am I missing here?

UPDATE I tried to investigate this problem in more detail. The full error message is this one:

....requires a value for the "$group" argument. in
Drupal\Component\Utility\ArgumentsResolver->handleUnresolvedArgument()
(line 148 of core/lib/Drupal/Component/Utility/ArgumentsResolver.php).
Drupal\Component\Utility\ArgumentsResolver->getArgument(Object) (Line:
54)
Drupal\Component\Utility\ArgumentsResolver->getArguments(Array) (Line:
157)
Drupal\Core\Access\AccessManager-
>performCheck('group_news.custom_access_check', Object) (Line: 135)
Drupal\Core\Access\AccessManager->check(Object, Object, Object, 1)
(Line: 112)
Drupal\Core\Access\AccessManager->checkRequest(Object, Object, 1)
(Line: 107)

The point where it fails in Drupal\Component\Utility\ArgumentsResolver->getArgument(..) is where is_object($this->objects[$parameter_name]) returns false, because my route parameter {group} that should be of type GroupInterface is actually of type String.

However, when testing another group module route that is not using a route-access check class, the {group} parameter gets noticed as GroupInterface. For example in

entity.group.leave:
  path: '/group/{group}/leave'

So the question points more in the general direction of how my route parameter '57' gets noticed as GroupInterface (or more general any specific type), because the same thing also fails when implementing my own little custom access check class (not using the group module at all).


texts:
I am using Commerce Fees module, as I want to add 5% as fees at the time of purchase.

I have added a fees type, and created a rule for this.

My Problem is that I whenever I go to checkout page where I have added some products such that my total order price is 1000, so I should be getting service tax of 50, but I am getting it to be 52.63 instead.

I am attaching my rules export, please help.

 { "rules_5_service_fees" : {
 "LABEL" : "5% Service Fees",
 "PLUGIN" : "reaction rule",
 "OWNER" : "rules",
 "REQUIRES" : [ "rules", "commerce_fees" ],
 "ON" : { "commerce_fees_order" : [] },
 "DO" : [
   { "data_calc" : {
       "USING" : {
         "input_1" : [ "commerce-order:commerce-order-total:amount-decimal" ],
         "op" : "*",
         "input_2" : "5"
       },
       "PROVIDE" : { "result" : { "tax" : "Calculated Tax" } }
     }
   },
   { "commerce_fees_apply" : {
       "entity" : [ "commerce-order" ],
       "fee" : "service_fees",
       "amount" : [ "tax" ],
       "currency_code" : "USD",
       "include_tax" : "0"
     }
   }
 ]
 }
 }


texts: Commerce 2.x attribute translations cause product duplicates in views

texts: If I add a translation for an attribute entity my views display duplicates products. I've tried to find an attributes delta filter, but  there is none. If I add a relationship for the attributes there is still no delta available in filters. Even if there was, I would need to add a relationship and filter for each attribute entity which would result in a rather massive view. I have also tried distinct views query and it does not work. How can I filter my product views on attributes language delta or another way to eliminate the duplicates?


texts: What is the difference between using Drupal as a CMS and using it as a Portal?

texts:
I have a lot of already existing web applications that are not in Drupal.  They are independent systems.  I am looking to create an Intranet solution to tie them all together, meaning, have links to them, not an integration with Drupal.

Is this using Drupal as a CMS or a Portal?  Does this go against the philosophy of what Drupal is for?  I want to use Drupal 8 if it matters.


texts: Module config page linked on Management Toolbar

texts:
I created a config page for my new module.  Whenever I enable the module, a link to the config page is added to the Management menu across the top of the screen as well as a configure link next to the module name in the Modules page.  How do I configure this page so that it just shows up with the configure link on the modules page and not in the menu.  Below is the code from hook_menu:

$items['admin/mymodule/settings'] = array(
  'title' => 'mymodule Module Configuration',
  'description' => 'Settings for my module',
  'page callback' => 'drupal_get_form',
  'page arguments' => array('_mymodule_admin'),
  'access arguments' => array('administer mymodule settings'),
  'type' => MENU_NORMAL_ITEM,
);

The module has a function called _mymodule_admin that returns a form array.  The config page works great. I just want to prevent the link from appearing on the management menu when the module is activated on my production site.

My info file contains the following line

configure = 'admin/timesdb/settings'

And my form callback has includes this line

return system_settings_form($form);

With the relevant form elements assigned above it.


texts: How can I change a content entity to a config entity?

texts: I created a project using Content Entity but now I need to change this entity to Config Entity. Do you know how I can do this?


texts: Views generated block - how to override filter on some pages?

texts:
On every page of his new site, the client would like a block with four featured links. This will be fairly consistent throughout the site, but on some pages he'd like to override and display four links of his own choosing.

I'm thinking of using Views and/or Nodequeue for the block, but I am not sure how to provide a default that can be easily changed for some nodes? Is there a better way?


texts:
I want to get access to a special field value, do some processing or manipulating on it and then place it back in theme. For example, I've created a custom content type that name is "News" and has a field with below properties:

label: News Number
machine name: news_num
value: Number (float)

I did content-type node theming with name node--news.html.twig, Now I want to understand Is there any preproccessing hook to modify or altering the field value and in addition I want to learn right way for manipulate the field value, I wrote something like below code:

ThemeName.theme:

function ThemeName_preprocess_node(&$variables) {
// Get access to field value:
  $value = $variables['node']->news_num();
/**
* Makeing some manipulation on $value here.
*/
  $variables['value'] = $value;
}

The type of operation is not really important; I'm most looking for a solution to learn standard method and general format to access and modify the field value.
I just want to overview the field value (alter the field value before rendering) and not doing any override or change the field value in the database.

Any suggestions?


texts:
Steps i followed

Created a vocabulary (V) and added 5 taxonomy terms to it.
Created a new menu (M).
In edit vocabulary (created before), selected Menu M as Menu location from Taxonomy menu
settings.
Hit Save button.

Getting this error

The Taxonomy Menu rebuild process encountered an error.

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=688&op=do StatusText: OK ResponseText:


texts: Fuzzy Search in Drupal 7 gives no results

texts:
I have setup Fuzzy Search in our website to provide 'intelligent' search functionality. I believe that the setup is all proper but despite the fact, I always get back 0 results. This is my search page for Fuzzy Search:

http://indiansnakes.org/search-fuzzy

I have exposed "Fulltext search" and I have indexed few key fields of the snake nodes from the website which has to be searched upon (like Common name, scientific name, snake description etc.)

I have setup Search Server for Fuzzy search as shown below:

Minimum word length = 3.

I would also like to know if there is a way to provide a dedicated database for Search server and it's indexed data?

Next, I have setup Fuzzy Search index which shows that the items have been indexed and it looks like this:

I have setup the Views for Fuzzy Search page like this:

Despite all this, my Fuzzy Search does not give back any results. Any idea what might be going wrong here?


texts:
I have a content page called Book, to which I also added an image field and a "term reference" to a Book taxonomy which has Book A, Book B, Book C, Book D, Book E as available terms in it.

I created 5 'Book' pages, inserted images and selected taxonomy terms (each taxonomy value are different).

I have another content page called List Book, to which I added a "term reference" to a Book taxonomy as well.

When I create a 'List book' page, I have to select a term from the Book taxonomy. If I select the terms 'Book A' and 'Book C', two images (related to Book A and Book C) will display.

Lastly I created a view with as a field the image field. As the filter, I added:

'publish = yes'.
'content type = Book' and 'List Book'.
taxonomy field from 'List Book'.

Field:
image from Book

There is no result.

What is the correct way?


texts: Views: Filter if Value of a field equals logged in user display name?

texts: How to do I create a filter on my view that filters based on the value of one field being equal to the name of the currently logged in user? The field is static.


texts: Force profile2 field display based on current user's role

texts:
I am using the profile2 and the profile2 page modules. I have 2 profiles called user and advanced_user and corresponding roles associated to them. The advanced_user has more fields available in his profile.

The problem: when I strip an advanced_user of his role (aka demote him to user), the extra fields that he previously filled in his profile form remain in his profile page and so is the "Advanced User" title. How can I remove the additional information that was added in the advanced profile?

Note: I wouldn't mind if the extra fields' information was kept stored (so that if I ever "promote" her again she would have the fields already populated) but I definitely want to keep them from showing in the user's profile page.


texts: Can I search for parent nodes from deep child nodes using Views?

texts:
I've a complicated hierarchy of nodes.
Node A contains(by node reference) multiple B nodes, each B contains multiple C nodes and so on.

Using Views will it be possible to reach C from A or vice versa given even higher depth level?

I think this is independent of D6/D7 views but I'm on D6.

There will be thousands of such nodes. Each top level A is an organization and there are a 1000 of them now. Information about each employee or department will be held in File(aka file cabinet) which again is a node).

I want to give users facility to search information from one end to another.

Update: The parent to child relationship is one to many


texts: ctools modal form shows ugly access denied

texts:
I have made a modal form using ctools. The form works okay when the user has access rights, but with no access rights an empty modal form is showing and I get a browser error saying

"An AJAX HTTP error occurred. HTTP Result Code 403" (and a lot of debugging information)

Is this a flaw in ctools modal or am I missing something?

In case of access denied I would like to fall back to a standard access denied message.


texts: How to create a Node Info Bar (or Node Info Block)?

texts:
I want to create a teaser with 3 sections:

Title Section.
Information Section (Info Bar):

When this Node Writed? (Date & Time).
Whom is writed this Node: (Author of Node).
What category consist this: (taxonamy or category).
How Many Viewed (Node View Statistics).
How many add Comment (Comment Statistics).

Show only "Read more" Linke: at the bottom of a node teaser and remove or unset other links like the "Add New Comment", "2 New Comments", "2 Comments" at the end of a node teaser,
because I dont think it makes good sense for people to comment on something that they haven't read yet.

I want to achieve something like the following picture:


texts: Should I disable the core content translation module in favor of entity translation?

texts:
Developing a multilingual site in the autumn of Drupal 7, I am inclined to use entity translation all the way.

Drupal core comes with content translation. If I have both enabled, I am having a confusing user experience while editing content. I disabled content translations (and some modules that required it), and entity translation still seems to work and everything makes more sense. So tempted to keep it that way.

However .. I just disabled a core module. Is that ok?


texts: Error messages don't work with a render block

texts:
In my template.php file, I added

function MYTHEME_preprocess_node(&$vars) {
   $block = block_load('my_module','my_delta');
   $render_array = _block_get_renderable_array(_block_render_blocks(array($block)));
   $vars['my_output'] = drupal_render($render_array);
}

In my custom-node.php file, I added

<?php print $my_output; ?>

My block is already displaying but the problem is:

My block contains a form with required fields, if I submit with an empty required field, the error messages are not displaying.

Any idea please?

Thank you


texts:
I have recently taken over the final stages of construction of 3 websites that were built in Drupal 7. I have never used drupal before and have run into a problem. My footer in one of the websites is not visible. This was due to the color style sheet not being pointed to in the page code. I copied the existing code into dreamweaver and resolved the issue, but cannot upload to the server as I cannot find the pages on the server, so i have no file i can replace.

The code looks like this:

@import url("themes/bartik/css/layoutb3ea.css?mry7g9");

@import url("themes/bartik/css/styleb3ea.css?mry7g9");

It needs to look tike this:

@import url("themes/bartik/css/layoutb3ea.css?mry7g9");

@import url("themes/bartik/css/styleb3ea.css?mry7g9");

@import url("sites/default/files/color/bartik-23dc1686/colors.css?m9ub8w");

You can see that the last line of code is missing.  I am used to working in dreamweaver and I am not familiar with the how the file system works in Drupal.

How do I add that line in to all the pages?


texts: Store value in file entity field using a form

texts:
Apologies in advance, this question probably has an obvious answer.

I am using a custom form with a 'managed_file' widget named 'image' to upload image files to the public file directory:

$image = file_load($form_state['values']['image']);
$image->status = FILE_STATUS_PERMANENT;
file_save($image);

I am using File Entity Module to attach to image file entities a caption text field (the machine readable name is 'field_caption'). On the custom file upload form there is a 'textfield' widget named 'caption' whose submitted value I want to store as the value of the image file entity's 'field_caption'.

Certainly, Drupal needs to first realize that the uploaded file is in fact an image file, as other file entites might not have attached a caption text field. That's why in the code above I first save the file before the code is followed by

if (isset($form_state['values']['caption'])) {
$caption = $form_state['values']['caption'];
$image->field_caption[0]['value'] = $caption;
}
file_save($image);

However, after submission the caption text field is always left empty.

Did I choose the wrong commands to store a value in field_caption?


texts: What does this allowed_html setting mean?

texts:
allowed_html: <a href hreflang title id target rel class=""> I copied this from the settings of the filter_html plugin in a filter format config entity. I am intrigued by the class="" part. I looked at both FilterHtml::getHTMLRestrictions processing this and FilterAPITest and I found
a test for 'allowed_html' => '<a> <b class> <c class="*"> <d class="foo bar-* *">' but not class="". So how is class="" different from just class or class="*" or omitting class altogether?


texts: Are there alternatives to using URL to Image Formatter?

texts:
We had a need to set an image as a background element for a
 tag (see example below). When we tried to the following (with Image as formatter) it only returned the original image url, not the image URL based on the image style.

Without having to use preprocess hooks to modify the URL, we have set the display formatter to be "URL to Image" on the default View Mode and we get the desired results. If I want to use Image formatter, I had to write a preprocess hook, which I want to avoid and adding an additional module like twig_tweak seems over complicating it.

Are there any other alternatives to using the URL to Image formatter and {{ content.field_image.0['#markup] }} without having to use a preprocess hook?

Example using Image formatter

{{ content.field_image.entity.uri.value }}

Results

Example using "URL to Image" formatter

{{ content.field_image.0['#markup] }}

Results (desired results)

Alternative solution

This looks like it will get the url to image with image style.

Set formatter as URL to Image
in twig template use {{ content.field_image.0 }}


texts: Custom Permission Not Appearing in /admin/people/permissions

texts:
I have a custom module my_module for Drupal 8 and I've added a custom permission yml file with 1 static permission:

modules/my_module/my_module.permissions.yml

My Custom Feature Permission:
  title: 'Access custom feature'
  description: 'Gives access to the custom feature.'
  restrict access: true

modules/my_module/my_module.info.yml

name: 'My custom module'
type: module
description: 'Blah'
core: 8.x
package: 'My Company'

I was expecting to see a new permission show up in mysite.com/admin/people/permissions under the category "My Company" but there is none.

Is there something else I need to do to get the permission to show in /admin/people/permissions?

I've been following these instructions:

https://benmarshall.me/drupal-8-module-permissions/
https://www.aram.cz/article/custom-permissions-drupal-8


texts:
Node status does not change.
If I set status = 1 it works fine.

function yt_common_changes_mark_spam($args) {
  $num_updated = db_update('node') // Table name no longer needs {}
    ->fields(array('status' => 0))
    ->condition('nid', $args, '=')
    ->execute();
  // $result = db_query("UPDATE {node} SET status = %d", $args) ;
  if($num_updated) {
     drupal_set_message('Content Mark as Spam successfully'.$args);
     drupal_goto('node/');
  } else{
      drupal_set_message('Content did not Mark as Spam successfully'.$args);
      drupal_goto('node/');
  }
}


texts:
I was using window.history.back() ,

Back

and

but it is not working in d7


texts:
I am building a proof of concept ecommerce solution using commerce kickstart v2

I wish to implement a system where a user can submit an order but an admin must approve orders before the customer can pay - I have a feeling I can do this with rules & extra order statuses but I cannot figure out which part of the checkout process to intervene in.  Heres what I have so far:

extra order status "Awaiting Admin Approval"
extra order status "Approved by Admin"
Rule that fires when order status changes from 'shopping cart' to 'checkout' and sets order as "Awaiting admin Approval"
Rule that fires when order status is "Awaiting Admin Approval" and path contains 'checkout'. this rule redirects user to a page that says 'your order is awaiting approval'
Rule that should allow user to checkout once admin has changed order status to "Approved by admin"

Rule 5 above (in italics) is giving me problems, no matter what I try - rule # 3 always fires, even after the order has been approved, which results in the user being redirected.

The problem arises because once the order has been set as "Approved by Admin", it must then go back to "shopping cart", then "checkout"... which then fires rule 3, which brings me nicely back around in a circle.

Any tips or suggestions?


texts: my css and javascript files do not load and do not work?

texts:
my uploaded drupal7 website worked correctly for 2 days.but suddenly when i refresh it,every things go wrong.
site loads with no css and no java,and no pictures.
it said that the css (and js) files couldn't be found even though they were very clearly there.and i can open them from cpanel.
i delete all files and my database completely from my host,then i upload all files and database again,but nothing changed.
actually i did this work several times.and nothing changed.
my website on localhost work correctly.
i do not know what is the problem?and how i can fix it?
is the problem from my host?
my website url:www.tehrantoyur.com
please check it,and guide me completly.


texts: Downloading, and loading Google analytics script locally and daily with Drupal Cron

texts:
I'm using Drupal Google Analytics module for some time; It works perfectly and gives me the data I need.

Yet, since instilling it, I get the following notification on Google Pagespeed Insights:

Do you know a way to load the script locally and daily in Drupal so to prevent this notification?

Is there a way to make add a automation to Cron to download the famous ga.js script daily from Google, load it, and then, the next day, delete it, and repeat the process?


texts: How to add multiple havingCondition with OR operator?

texts:
I want to add havingCondition with OR operator

In normal sql query my having conditions are like:

group by n.nid
having comment_count!=0 OR viewed_count!=0 OR likes_count!=0;

With adding multiple havingConditions like:

$query->havingCondition('likes_count', 0, '!=');
$query->havingCondition('viewed_count', 0, '!=');
$query->havingCondition('comment_count', 0, '!=');

but It gives having condition with AND operator

Can any one please help me in.


texts: Output node reference field data in page.html.twig

texts:
I have a homepage node-type in which I have an entity-reference field holding 3 references to 3 separate custom blocks.

The theme I'm working on requires that my 3 element reference field needs to be output in page.html.twig. I have overridden page.html.twig and I can see changes I have introduced once my caches are cleared.

My research led me to implementing a custom module to preprocess my homepage ouput and include the data I want printed from page--front.html.twig, code below:

function mymodule_preprocess_page(&$variables, $hook) {
    // $url_obj = Url::fromRoute('<front>');
    die('tested');
    dsm($variables);
    drupal_set_message('testing');
}

My problem is my preprocess function is not triggered. The module is enabled, and calling die() outside a function does "kill" the site, so the module file is recognized.

I would appreciate any help.


texts: Form redirection to registration for anonymous users while preserving data entered

texts:
How is it possible to have CCK form on the front page for instance and once the user clicks on "Save", check if the user is already signed in and if not, redirect to the creation of an account, but by keeping the data entered in the CCK form to avoid them to reenter every field ?

I've checked on the net but nothing seems to do this so far...

Thanks for any help :-)


texts: Make field content as exposed filter dropdown

texts: I have a field in my node like brand, where in admin enters the brand name and creates the node. I want to make a exposed filter out of this as a dropdown with all the data entered by the admin. How do i do it ?


texts: One of our drupal themes is causing safari to display a security popup warning

texts:
Attached are screenshots of the popup.

Only displayed for a particular theme. This is kinda tricky for me to debug because, I use a PC.

My client reported this error to me.

He says it only happens when that one particular theme is the active theme.

Can someone shed the light here? What are the possible reasons that would trigger this popup message on safari? It will help me know what and on which files to look.

Thank you :)


texts: Variable in theme_preprocess_page is changed before page.tpl.php

texts:
In my theme_preprocess_page() function, I set a variable to a default value. Then, in an if(!empty($variables['node'])) { } block, I do various calculations to give that variable the value I actually want.

At the bottom of that function, the variable has the value I want, confirmed by dpm(). I set $variables['my_var'] = $my_var. After that, $variables has an entry with the correct name and correct values, also confirmed by dpm(). The function ends immediately thereafter.

But in page.tpl.php, when I dpm($my_var), it shows not the correct value, not a "variable doesn't exist" error, but instead the default value I set at the top of theme_preprocess_page().

It gets weirder. When I started writing this question, a dpm($variables['my_var']) at the top of theme_process_page() correctly displayed the variable. I realized that I should have had a test at the bottom of that function as well. When I added it, the variable started having the correct value in page.tpl.php! Then I started messing with just the dpm() calls in theme_process_page(), and now I'm in a state where none of the dpms in theme_process_page() display the correct value!

I'm flummoxed and my boss is flummoxed. What is there between template_preprocess_page() and page.tpl.php that could be doing something strange with this variable, particularly to make its value in template_process_page() behave indeterminately?

This post, illustrated:

template.php

<?php

function theme_preprocess_page(&$variables) {
    $myvar = 'default';

    if(!empty($variables['node'])) {
        // ...

        $myvar = 'modified';

        // ...
    }

    dpm($myvar, '$myvar at bottom of preprocess_page');

    $variables['myvar'] = $myvar;

    dpm($variables['myvar'], '$variables[‘myvar’] at bottom of preprocess_page');
}

function theme_process_page(&$variables) {
    dpm($variables['myvar'], '$variables[‘myvar’] in process_page');
}

?>

page.tpl.php

<?php

dpm($myvar, '$myvar in page.tpl.php');

?>

Messages area in loaded page

  $variables[‘myvar’] in process_page => [Sometimes 'default', sometimes 'modified']

  $myvar in page.tpl.php => 'default'

  $myvar at bottom of preprocess_page => 'modified'

  $variables[‘myvar’] at bottom of preprocess_page => 'modified'


texts:
I have a drupal installation in a sub folder (demos/drupal) and it supports two languages (english -default- & arabic). I imported the drupal content from an old site. My problem is that the language prefix (i.e. en or ar) is added to the url of all images and this causes the images to not appear. for example: http://www.mysite.com/demos/drupal/en/sites/default/files/image.png).

Can I remove the 'en' and direct all urls to "sites/default/files..etc" using htaccess rules?

I can't modify the content and find/replace the urls  in the database so I'm looking for a solution to avoid that.

Appreciate your help.


texts: How do I invalidate the cache of an entity?

texts:
Is there any easy way to clear the cache for a custom entity?
I know there is an entry in the cache_entity-Table. If i manually delete it, everything is fine.
I tried doing the same as in \Drupal\Core\Entity->invalidateTagsOnSave() or \Drupal\Core\Entity->invalidateTagsOnDelete(). This does not seem to change anything.

Unfortunately I can't just load the entity and resave it in this situation.


texts:
I have 3 drush-aliased sites: @DEV, @STAGE & @PROD

rsync & sql-sync all work between them.  At the moment, that's both directions, between any two sites.

I want to limit the sync paths to only allow sync in the following cases:

(1) @DEV -> @STAGE, files & db
(2) @STAGE -> @PROD, files & db
(3) @PROD -> @DEV, db ONLY

How do I limit drush sync to allow only those three cases of sync, preventing all others?


texts: How to deal with this kind of node references, when creating a new instance of a content type?

texts:
I'm new using Drupal, and I'm trying creating a database driven website in Drupal. I don't know what is the best way of doing the following:

I need to have three types of 'entities' (content types):

Worker
City
State

Every Worker lives in one and only one City, and every City is in one and only one State.

I could create those three contet types:

State
City, that will have a node reference to State
Worker, that will have a node reference to City

But...

When I someone creates a new Worker, I don't want Drupal to show a list with all the cities (because there could be cities with the same name in different states).

How could I add the feature of selecting first the State, and then the City, when creating a new Worker, or something like that that allows the user to differentiate?

Edit:

The module Dependent Fields would work in this case, but it forces me to add another field to the Worker content: A State. I don't want this, because it could be kind of redundant information (knowing the city of the worker, I can also know the state). Do you know what I mean?


texts: Custom criteria of summary items with contextual filters in Views

texts:
Drupal 7. Views 3.

I have two contextual filters: terms of a vocabulary and dates. The no-results behavior is to display a summary, so I get three different screens in my view.

In the first screen, I see a list of terms. In the second, after clicking a term I see a list of dates associated with nodes tagged with that term. Then, after I click on a date, I see a node gallery.

On the first list, I want to be able to sort my list of terms by term weight, but the only sort criteria options I'm given in the contextual filter configuration are alphabetical or by number of records.

How does one custom-sort summary items of a contextual filter in Views 3?


texts: Setting the default front page setting to be translatable

texts:
I've enabled the following multilingual modules:

Configuration Translation
Content Translation
Interface Translation
Language

Configuration translation enables me to translate the site title and slogan, but how can I translate the default front page setting to have a different front page per language?

I can see the setting in system.site.yml:

page:
  403: ''
  404: ''
  front: /node

but overriding it in language/de/system.site.yml doesn't seem to help.

Is there anyway I can activate the setting for translation?


texts: Allow customers to add arbitrary data to products when adding to cart

texts:
I've got a product type called workshop and I want customers to be able to specify the names of their kids when they add a workshop to the cart. If I could figure out how to add any arbitrary data at all I'm sure I could carry this through to where I ultimately want it to be, which is that the arbitrary data would actually be a choice of some number of Paragraph entities referenced by their user profile, but all the solutions I have been able to find seem to be for Drupal 7, so I'm dead in the water.

Any suggestions?


texts: I have an issue with field label translation

texts:
I am working in a multilingual website (French, English, German) with french as default language.

Then I installed the module internationalization + field translation.

Globally, everything works fine. The translate interface is do its job. The issue comes with field labels.

I setup all fields (more than 300) in french language, so the client would be able to translate the labels in english + german through the translate interface (admin/config/regional/translate/translate). Apparently the problem is that Drupal detects field labels as being in english language, instead french as expected.

For example in this picture, you can see that label "surface en m2" is detected as an english text.

This is weird because when I am in edit form page, the content seems detected as french (original text).

Anyone was confronted to this issue?

Thanks


texts:
I have a video field that should be visible only to authenticated users on one content type (bundle), but unrestricted on another content type.

What's a clean way to hide this field on one content type only, for anonymous users?

Notes:

I have the module field permissions installed, but it doesn't support per bundle field permissions.
I'm using Display Suite, so I'd rather not use a custom template unless that's the cleanest way to handle this one field.
I could create a new view mode that hides this field and and use HOOK_entity_view_mode_alter to switch to that view mode for anonymous users, but there are quite a lot fields to display so having 2 big view modes that are 95% the same seems kind of silly.

Edit: This is the code I used based on @wolverine's answer below:

function HOOK_utility_field_access($op, $field, $entity_type, $entity, $account) {

  //Check video field only when attached to 'lesson'.
  if ($field['field_name'] == 'field_video' && $entity_type == 'node' && $op == 'view' && $entity->type == 'lesson') {

    //Grant access only if user is logged in.
    if ($account->uid > 0) {
      return TRUE;
    }
    return FALSE;
  }
}


texts: Add 150 grams to each order for calculating shipping

texts:
how can I add 150 grams to each order for calculating shipping costs (this weight corresponds to the packaging)?
I looked in the rules, but I do not see how to do this.


texts: How to insert custom created user register fields value in to tables

texts:
I have created few custom fields using

  configuration > people > account settings > manage fields

for user register form. I'm able to display the custom fields in my user registration page and I created a table to save all my user registration page details. I don't know how to insert my custom fields value into my table. I have tried using hook_user_insert but no luck.

Any suggestions?


texts:
I have a relatively fresh instance of Ubuntu 16.04 running a Drupal 7 site, with php5.6 installed instead of php7.  The drupal site runs well.  I am trying to get drush installed so that I can easily do updates.

I have done the global install per http://docs.drush.org/en/8.x/install/

Specifically, as the ubuntu user (no root login)

wget http://files.drush.org/drush.phar

/usr/bin/php5.6 drush.phar core-status

PHP configuration      :  /etc/php/5.6/cli/php.ini
 PHP OS                 :  Linux
 Drush script           :  /home/ubuntu/drush.phar
 Drush version          :  8.1.12
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :

chmod +x drush.phar

sudo mv drush.phar /usr/bin/drush

/usr/bin/php5.6 drush --version

Could not open input file: drush

What am I missing?


texts:
I was trying to install Aegir following the Automatic install guide, but I get an error. I've tried to install Aegir 2, then tried also Aegir 3, but the error is the same. Any clues?

Here's the message:

  The following settings will be used:
    Aegir frontend URL: site.dev.local
    Master server FQDN: site.dev.local
    Aegir root: /var/aegir
    Aegir user: aegir
    Web group: www-data
    Web server: apache
    Web server port: 80
    Aegir DB host: localhost
    Aegir DB user: root
    Aegir DB password:
    Aegir DB port: 3306
    Aegir version: 7.x-3.x
    Aegir platform path: /var/aegir/hostmaster-7.x-3.x
    Admin email: aegir@site.dev.local

  Aegir install profile: hostmaster

  Do you really want to proceed with the install (y/n): y
  Enabling hosting-queued daemon

  The drush command '@hostmaster pm-enable hosting_queued' could not be found.  Run drush cache-clear drush to clear the commandfile cache if you have installed new extensions.                       [error]
  A Drupal installation directory could not be found                                                                                [error]

  dpkg: error processing package aegir3-hostmaster (--configure):
   subprocess installed post-installation script returned error exit status 1
  dpkg: dependency problems prevent configuration of aegir3:
   aegir3 depends on aegir3-hostmaster (>= 3.0.1); however:
    Package aegir3-hostmaster is not configured yet.

  dpkg: error processing package aegir3 (--configure):
   dependency problems - leaving unconfigured
  No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                Errors were encountered while processing:
   aegir3-hostmaster
   aegir3
  E: Sub-process /usr/bin/dpkg returned an error code (1)

Thanks!


texts:
I was writing on a module for drupal and i had to update some fields in the user-object. I first tried this code:

$account = user_load($user->uid); // Loading account
$edit = array(
  'gitlab_refresh_token' => $response_data['refresh_token'],
);
user_save($account, $edit);

This did not update the the field.

Then i found this code on the Internet:

$existingUser = user_load($user->uid);
$existingUser->data['gitlab_refresh_token'] = $response_data['refresh_token'];
user_save((object) array('uid' => $existingUser->uid), (array) $existingUser);

This code works. But the question is why?

The documentation for user_save() says, that $edit just needs to contain an array with key/value pairs of what you want to change and it will be put in the user's data field,
and that is what i did, right?


texts: Add commas between allowed file extensions

texts:
I need to restrict the user to upload only the file extensions that i mentioned in the Allowed file extensions filed. It works properly. But in front-end, i need to add a comma separator for this format.

Actual - Allowed file types: ai aif avi bmp csv doc docx eps fla flv gif img.

Expected - Allowed file types: ai, aif, avi, bmp, csv, doc, docx, eps, fla, flv, gif, img


texts: Given a block_id, what would be the most reliable method to decide if the block was generated by Views?

texts:
I would like to use hook_form_block_admin_configure_alter to add configuration options to the blocks admin, but only if the block is for a View. It's important to add the settings here rather than in the view settings itself, since it will grouped with other additional block settings that are not Views specific.

Thanks!


texts: URL redirects within drupal 7 site breaking image display in blocks

texts: I am developing a drupal 7 site where 4 pages have url redirects from a parent page within the site. I have a block in the footer that is shown on all pages but the 4 pages mentioned above do not display the image within that block. I'm thinking that it must have something to do with the redirects as it is only these 4 pages that don't display the image. All other pages with that block show the image up just fine.


texts: Can I automatically expand my paragraph item after the node creation?

texts:
I am using Drupal 7.x and have created a new content type with fields and a paragraph. Now when I create a new node I can fill in the fields and add a new paragraph item but I want to be able to fill my 1st paragraph item immediately instead of clicking on the add paragraph first (so it should expand already the moment I create the node).

Is there a configuration setting I am missing or a module that offers this kind of functionality?


texts:
I'd like to install CRM Core module for one of my clients. But I cannot decide which release to use - stable or development. The Recommended release (7.x-0.964) looks more confusing to me while the Development release (7.x-1.x-dev) looks more logical. But I don't know if there any risks of using Development release in production.

Could you please advise the right way to go.

Thanks in advance!


texts: How do I add a custom style to node by its type?

texts:
I've tried following the instructions on http://drupal.org/node/1089656, but I somehow can't get it right.

How do I apply custom layout/style to a node based on its type?


texts:
I've got code that loops through nodes in order to generate processed output.

I've previously done an entity query that provided an array of node IDs. My main loop code looks like this:

foreach ($this->nids as $nid) {
    $node = Node::load($nid);
    $nodeData = $node->toArray();
    $nodeURL = $propertyNode->toUrl()->toString();
    print "Mem usage: ".memory_get_usage(true)."\n<br>";
}

Obviously, the loop shown here is a minimal example to demonstrate the problem; as it stands, it's pretty useless as it doesn't do anything with the data it loads.

However despite this, the loop is eating memory. The debug call to memory_get_usage(true) in the loop gives a bigger number every time, until the script eventually runs out of memory if I feed it enough nodes (about 300 seems to be enough to kill it).

Obviously, I can increase the memory available, but I'm reluctant to do that because I can't seee why the loop would be leaking memory in the first place.

Can anyone please explain why this fairly basic loop is causing a memory leak, and what I can do to prevent it?

A few additional notes:

I've tried adding unset() at the end of the loop to clear the node and data variables; this doesn't have any effect (I wasn't expecting it to, but I tried it anyway).

The nodes in question have about fifty custom fields, including a couple that are paragraphs, which in turn have fields of their own.

My real code passes the node data to a processor class that reformats it for use elsewhere. It builds an array of these objects, but they aren't the cause of the memory leak, hence why I've excluded them from the example code.

I'm currently running on Drupal 8.6; haven't had a chance to look at the 8.7 release from yesterday yet.


texts: How do I create additional fields in module.install?

texts:
I am creating a module in the ".install" file, using the following code:

// if not exists, create new content type
if (!node_get_types('type', 'houses')) {
  $info = array(
    'type' => 'houses',
    'name' => t('Houses'),
    'module' => 'node',
    'description' => t('Manager Houses'),
    'locked' => FALSE,
    'custom' => TRUE,
  );
  $info = _node_type_set_defaults($info);
  node_type_save((object)$info);
}

It creates a new content type, but how do I create additional fields (e.g. text, nodereference)?


texts: Shipping profile address type select to radios

texts:
I am trying to alter the shipping information pane. It uses a select list for the profile address
I want to make it a radios type instead and when I use the form_alter to hook into the checkout pane, I just set the '#type'  => 'radios' instead of 'select'. Like below:

This does not work because of the array_parents in the callback (it has 2 extra parents which are appearing only when changed to radios)

Any idea how to solve this?


texts: View not displaying nodes to anonymous users (workflow + views)

texts:
After changing from WorkflowNode to WorkflowField, and migrating the content, the nodes are not displayed to any other user but to our Administrator role on the View we created for that content type.

Redid the view, but no success. Using Devel, it made me suspect node_access table (as reported by devel), so I rebuild permissions (no result).

Not sure I'm looking in the right place. Any ideas?


texts: Enabling Clean URLs on website-in-progress

texts:
I host my site and a few others through Hostgator. When I build a new Drupal site as a replacement for an existing site at a different host, I build it on the IP address (192.xxx.xxx.xxx/~username) or on the corrado (Hostgator) url (corrado.websitewelcome.com/username). In both cases, I cannot activate Drupal's "Clean URLs" feature. Once the site is built and we are ready to point the domain name to the new site (and we do so), Clean URLs works fine. It is an issue, though, while I am still building the site, because I have to use absolute URLs in the CSS and the various content blocks for the links and images to work correctly, and that creates extra work during the website activation process where I have to go back in and remove all of those absolute URLs. I have tried modifying my hosts file so that the site's existing URL will resolve to the Hostgator IP address for that new site-in-progress, but this isn't enough to "fool" the Clean URLs function.

I already reached out to Hostgator support, and they did not have a solution for me. Any ideas on how I can work around this issue and get Clean URLs to work in this environment?


texts: Is it okay to edit the webform content type?

texts:
I want all the static pages on my website to have an image at the top of them. So instead of using Drupal's Basic Page type, I created my own type (Simple Page) that has:

Title
Body
Image

I have enabled Webform module on my site and created a simple Contact Us form.

The problem I have is that the Contact Us page (a Webform) does not have an image at the top, like all my other pages. To fix this, I edited the webform content type and added an Image field, and now my Contact Us page follows the styling of the other pages.

But it feels wrong, editing the Webform type directly. (Its as if I have hacked core!) And now I am worried that I'll have problems when I upgrade the Webform module.

Is there a better way that I could have done this?


texts:
We have a single site that we'd like to have two different domains: apply.school1.edu and apply.school2.edu.

The site is at apply.school1.edu and we'd simply like to create a domain apply.school2.edu to point to apply.school1.edu. That way we can use the domain to determine what content to load on the page.

How can we do this?


texts: Setting php E_NOTICE within my .module file

texts:
I want to set E_NOTICE only within the .module files which I create. How can I do it?

I want to catch mis-spelled variable names which are difficult to catch.


texts: How do I print a username of current profile?

texts:
I am making a profile page for users on my site, and would like to print out their username. If I do print $user->name it will just print out the username of the currently logged in user, I want the username of the profile I am looking at.
Thanks.


texts: How do I get a parent-group alias as token for the Pathauto module?

texts:
When a user sets his groups alias to lets say "mynewgroup" you can view the group at www.example.com/mynewgroup.

How to set pathauto presets to create www.example.com/mynewgroup/mynewgroupcontent as a path for a newly created group-content?

I can not find a token for parent's group alias.
I can only find [group_content:gid:entity:url] - but this provides full path and not only the alias.


texts:
I am trying to figure out the best way to add a panel page navigation item to the local task menu set.

I want to create a Panel Page with QuickTabs to build a simple UX for a non-drupal admin to updated and edit users for there events.

I can add the quick tabs etc. to the panel page, however, I am not sure how to add the menu item to the local task menu tabs.

So, when you edit an event here is what I want the menu to look like...

View | Edit | Panel Page

So, Panel Page  is the new local task menu item for my panel page. I have been searching for a way and change not find it.


texts: Change base url depending of node field value

texts:
There is a multi-site (2 sub domains) running Drupal 7. Each node has a field where I set the site this node has to be shown on. It is also an option to show the node on both sites. For SEO reasons I have to keep those on parent domain. So actually there are 3 sites.

On both sites there is a list of available nodes. In the sub1.site.com it consists of nodes marked 'for sub1' and 'for all'. In the sub2.site.com - of nodes markef 'for sub2' and 'for all' accordingly.

So when Drupal is collecting titles for show it has to make a proper url (actually a proper base url) for each node. That's the task.

I know how to make it for a certain page or pages one by one, but I feel it's better to make it in some global way. But I'm confused where exactly (and also how exactly) it would be the best.

Suggestions of any kind would be appreciated.


texts: How to place a custom javascript link/button in each row of a Views table

texts: I would like to place a link or button in each row of a Views table, and have custom javascript code executed, with field content taken from that particular row as input. The Javascript code already works fine outside of a Views table. How can I add such a custom Javascript link/button? Is this possible ?


texts: Views field cache tags does not invalidate the views cache

texts:
I've implemented CacheableDependencyInterface on my ViewsField plugin.

  /**
   * {@inheritdoc}
   */
  public function getCacheTags() {
    return ['arbitrary_tag'];
  }

I can see the tag on the HEADER and the View configuration object.

However, when that tag is invalidated, the View is not updated.

I've also tried using adding cache tags to the render method:

return [
  '#markup' => $message,
  '#cache' => [
    'tags' => ['my_list'],
  ],
];

Both to the Views field, but also tried directly on the View element using hook_views_pre_view

While debugging, I've made sure to try invalidate that specific tag:

Cache::invalidateTags(['my_list']);

While debugging further it seems like that the ResultRow values are still cached after clearing the tag.


texts: Create a list of events where an event can have more than one date

texts:
I am looking to create a view list of upcoming events but where each event may have more than one date as below:

Event 1 - 12th Jan

Event 2 - 12th Feb

Event 3 - 12th Mar

Event 1 - 12th Apr

Event 4 - 12th May

Event 5 - 12th Jun

Event is a content type with a Date field of multiple number values.


texts: How do I mass flag a node on behalf of users (possibly with VBO)?

texts: I have a view that returns the og members of a group. Users can additionally flag groups. I want all users returned by the view to flag the group. So I tried to do this with Views Bulk Operations (VBO), but the only available operation is "Flag (or unflag) a user". The flag is attached to the group, not the user. How do I do that?


texts: CKEditor toolbar missing when conditional field becomes visible

texts: I use the D8 Conditional Fields module to make a CKEditor field (author bio) invisible until there is something in another field (author). When I type something in the author field, the author bio field becomes visible, but it doesn't include a CKEditor toolbar. It appears that CKEditor initialization is not done on fields that aren't initially visible. Any way to overcome this?