texts: How to make a reference on same node without recursion problem

texts:
Here is the situation.

I have a content type called Product.

Content Type : Product
Title
Body
Color
Product Reference (Entity Reference on content type Product)

Thats mean For a specific product, I could referer this product to more product.

My problem right now is there is a Recursion problem.

Is there any other way to perform my needs.

Thanks a lot


texts: use-ajax class for ajax link not working in dynamic content load

texts:
use-ajax class link not working when i load new content using custom ajax code, which has the use-ajax class links.

I use normal jquery ajax to load the content because, i have drag and drop functionality which use ajax to load new content

i tried a lot but didn't get the idea why it is not working

Thanks in advance

jQuery(".clips-list .section-add-clip").droppable({
        accept: '.mysrapbook-clip-drag',
        hoverClass: "ui-state-active",
        drop: function(event, ui) {
            var source_url = ui.draggable.find('a').attr('rel');
            var destination_url = jQuery('.scrapbook-mongo-id').data('scrapbooid');
            var section_idx = Number(jQuery(this).attr('rel'));
            var ul_container = jQuery(this).parent().parent().find('li.clips-inner');

            var post_data = {
                source_url: source_url,
                destination_url: destination_url,
                idx: section_idx,
                load_node: 1,
                index_countr: ul_container.length
            };
            var ajax_data = jQuery(this);

            //call ajax to save clip to haggadah
            jQuery.ajax({
                url: "/clip-to-page",
                data: post_data,
                type: 'POST',
                success: function(data) {
                    //console.log(data);
                    console.log(data);
                    if (data[1].data != "") {
                        ul_container.last().after('
' + data[1].data + '
');
                    }
                }
            });
        }
    });

here is the code where i fire ajax to load new content and that content has 'use-ajax' class link which is not working it works fine page page is loaded


texts: How I can get nodes of type basic page of current month only in drupal views

texts: I want to create a view which display result of current month only. If I will add post date field in filter then what operator I will choose and how i can get results.


texts: How can I exclude admin(uid=1) for "Views Argument PHP Validator code" which limit a view to a User’s uid value?

texts:
I have a page view with a menu tab and URL looks like  my-site.com/user/%/my-view

I use return $argument == $GLOBALS['user']->uid; for default argument.
And then I would like to limit the argument to only the currently logged-in user’s uid but how can I exclude admin role (uid=1)?

After reading this article I tried this but didn't work.

global $user;
if($user->uid != 1){
return $argument == $GLOBALS['user']->uid;
}

What I need to achieve is:
Admin role(uid=1) can see my-site.com/user/%/my-view for all users but the rest of the users can see only the view according to their uid.


texts: Where do i change the settings of the redirected URL after a new user registers on my drupal 7 site?

texts: Where can i change the destination of the redirect after a user registers on my site? Currently it just hits them back to the homepage.


texts: Problems creating a custom blank page with my custom module

texts:
I'm trying to upgrade old Drupal 7 modules to 8 and I am struggling to figure out how to create a blank page (by this I mean, a page with zero HTML from enabled themes) for my module. I added routing to my custom controller, my controller method takes care of all the logic and returns the following array:

[
        'showVideo' => [
            '#theme' => 'videoPage',
            '#content' => $content
        ]
]

I already defined "videoPage" in mymodule.module using hook_theme:

Function mymodule_theme($existing, $type, $theme, $path){
  return array(
    'videoPage' => array(
      'variables' => array('content' => NULL),
      'file' => 'mymodule.html.twig'
    )
  );
}

"mymodule.html.twig" is a full stand-alone HTML file from the opening HTML tag to the closing tag. I don't want any other content to show up there but instead I'm getting the content in that Twig file, then followed by the HTML for the currently selected Drupal theme. Also, my {{ content.value }} calls in Twig seem to be getting ignored. And by this I mean, I can literally see {{ content.xyz }} in the markup being printed. The $content being returned by the controller is an array and I'm sure all the values are set. It almost feels like the Twig file is being called while the Controller's logic is being ignored. (this last bit has been solved by Clive's response)

Any help? Am I totally off in this approach?


texts:
Simple Question here I hope.

I've got a Format taxonomy field on my product type Record that's defining an attribute (cd, vinyl, download etc.).

I'd like to have the same order and default value on the attribute dropdown on product displays. I've set the terms in the vocabulary in the order I want on product displays but it still seems the order is random when browsing the site...

any ideas?


texts: Is it possible to work with authenticated users that are never stored in the database?

texts:
I have to authenticate users against a remote authentication API. In the API's response there are several user properties, some of them mappable to a Drupal User some of them not.

Because of legal constraints I don't want to store the users' data in the Drupal DB. I need "free floating" users. I checked some modules (externalauth, ldap), and as far as I understand every module does in fact use the DB to store user data.

I'd very much like to write an AuthenticationProvider that returns an entity which exists just for this single request. But I have a feeling that this approach is way too simple.

What would be the correct way of doing this (if it is actually possible)?


texts: I have attached a comment type to a content type via a field.  Right now all I can see is a link called Add new comment. How do get the comment form to render on the node and not show the link?


texts:
How is the Drupal Planet realised?
I found the Planet installation profile, but it seems to be dead (the Git instructions tab is empty).


texts: Update entity properties fetched with entityTypeManager()->getStorage

texts:
I am loading all entity types I need to update like below

$current_fruit = \Drupal::entityTypeManager()->getStorage('fruit')->loadByProperties(['status' => '1']);

Then I update them in a way that I loop through the object and if particular value is matched I update some properties.

Thing is I am wondering is it possible to not loop through all of them, but just use some "magic" get method to find entity within loaded entities and then updated it, or is the foreach best method to do this?
Something like

$fruit = $current_fruit->name->getByValue("Apple);

and then I could just use

$fruit->set('price', $40);
$fruit->save();


texts: Add "email" to /admin/people overlay view

texts: I have been browsing around trying to find the answer to this but I am not having any luck. I want to add the users email to the table so that we can identify them easier. I have tried to create a new page and use "/admin/people" as the path but I get the error that it can not be overridden. I am relatively new to Drupal so if it sounds like a noob question that is why.


texts: managed_file FormElement submitting form upon file upload

texts:
How do i prevent managed_file(Browse Button) from calling submitForm function upon uploading file?
I've added

 '#attributes' => [
  'submit' => FALSE,
  'onclick' => 'return false'
]

to no avail.

This is the UI.

Upon uploading file

managed_file and submit code below -

    $form['fileUpload'] = [
    '#type' => 'managed_file',
    '#upload_location' =>  Settings::get('bulk_imsi_excel_upload', '0'),
    '#multiple' => FALSE,
    '#upload_validators' => [
      'file_validate_extensions' => array('xls')
    ],
    '#attributes' => [
      'submit' => FALSE,
      'onclick' => 'return false'
    ]
];

$form['submit'] = [
    '#type' => 'submit',
    '#value' => $this->t('Submit'),
    '#attributes' => [
      'class' => ['use-ajax-submit'],
      'style' => 'color:white;'
    ],
    '#ajax' => [
      'callback' => '::submitForm',
      'event' => 'click',
      'progress' => [
        'type' => 'throbber',
        'message' => 'sending request'
      ]
    ]
  ];


texts: Does Drupal have any security like Dexterity in Plone?

texts:
Is there anything in Drupal's security like Plone's Dexterity where I can wrap content in my webpage and have it displayed or not displayed based upon security roles?

EDIT:  Thanks.  None of these do what I'm asking, however.  I want to wrap a piece of content on a webpage and based upon the user hide or display it,

<? if user in group or role x (?>
<input type=buttong value="approve employee for vacation time" />
<? else ?>
Supervisor not approved yet
<?)?>

Don't get hung up on vacation.  I'm not looking for a workflow.  It could have said anything.  Show DOB, SSN, etc

I have to query outside databases like Oracle, SQL Server, and so on to get this information.  It will not be resident in the Drupal database, only the security will be.


texts: Redirect example.com to example.com/node

texts:
Currently I am facing ERR_TOO_MANY_REDIRECTS problem in chrome when I try to visit example.com. Since example.com/node is working fine, I want to redirect all the traffic to example.com/node for now.

How do I achieve this ?


texts: How replace city text box in shipping address with select component in drupal 7 commerce

texts:
I want to know, is there any way to change city textbox in shipping address (in Drupal commerce 7) to select component?

in normal mode, user have to write the name of city but I want to change it to select field so user can select a city between available items in select field.

Also I want to add another select field to address that contains provinces.


texts: Secure Way of sending argument from one page to another

texts:
In my Drupal Page I have one l() function as follows:-

l('View Comments','admin/comments', array('query' => array('commentid' => $rinap_comm['record_id'])

So in this case I am passing the argument to new page 'admin/comments' using 'commentid'. The url will look like this:-

http://XXXX/someURL?commentid=15

In new page I will retrieve the value using

$commentId= $_GET['addUser'];

This is all fine to get and set argument using GET function.
But I didn't find it secure way to transfer confidential information from one page to another as the value will get appended in URL which can be visible to everyone.

Can anyone please suggest if there is more secure way of passing the information without visible to end user? If possible please brief me the steps.


texts: theme superfish menu item link add query string

texts:
I need to add the destination to user/logout links in the THEME_superfish_menu_item_link preprocess function, but I am having no luck.

In template.php I have:

function THEME_superfish_menu_item_link(array $variables) {
  if ($variables['menu_item']['link']['link_path'] == "user/logout") {
    $dest = drupal_get_destination();
    $link_path = $variables['menu_item']['link']['link_path'] . '?destination=' . $dest['destination'];
    $menu_link = l($variables['menu_item']['link']['title'], $link_path, $variables['link_options']);

    return $menu_link;
  }
}

My links end up encoded: /user/logout%3Fdestination%3Dhome

I assume query strings can be added as parameters to the $variables['menu_item'] but am unsure how.


texts:
Add JS in themes.info

scripts[] = js/style.js

scripts[] = js/custom.js

scripts[] = js/common.js

But I Want to custom.js and common.js Add Conditionally

custom.js add only Front Page

And

custom.js add all page escape Front Page.

I want to add js only From themes.info File.


texts: How to target specific sites with Drush when using Multisites?

texts:
I have a Drupal Multisite set up. It contains two sites, but the core Drupal install has no site.

With Drush, I can use @sites to target all sites. For example:

drush @sites -y cc all - Updates all multi-sites
drush @sites -y en jqmulti - Install Jquery in all Multi-Sites

However, because I have no site installed in the core folder, I always get an error message  stating that the core site is missing. Is there any to use Drush to only update the sub-multisites and skip the core one?

I know I can run Drush from the sites directory of the sub-sites, but that isn't very convenient when I want to target all sites.

The reason I am using Multisites is because both sites share themes and user-logins.


texts: Why is the order of my Taxonomy list ignored when viewing the content?

texts:
I have a Drupal 7 local build and one in PreProd.

Using Git to manage the code base so we know they are aligned.

Moving Taxonomy by dragging items works fine on my Local build however the same exercise does not work on PreProd. The order of the Taxonomy list is ignored in PreProd when viewing the content. I have exported the DB from PreProd and imported into Local. This works on Local!

I have cleared cache every time.

Any ideas what this could be?


texts: How can I count how many times a node appears in a view?

texts:
I would like to keep a count of how many times a node is displayed in a view. For example, in my home page I have a view that displays a list of 20 products. I can count how many times users click on it. I can also count full node views.

But what I would like to do is to count how many times this product is displayed in this view. I use a random system to show users different products each time the home page is reloaded.

I have searched a lot, with different statistics modules, for example radioactivity, node view count, and entity view count but I'm just not able to find something that do what I want.

The answer should work with caching of the view enabled as well.


texts: Adding an existing media image from a programmatically created node

texts:
I have a form that allows users to upload multiple pictures. These images are saved as media in admin/content/files. This upload process is managed by #managed_file type. Below is an example

$form['upload']['uploaded_file'] = [
    '#type' => 'managed_file',
    '#title' => t('Upload your file'),
    '#multiple' => true,
    '#upload_location' => 'public://my_files/',
    '#upload_validators' => [
        'file_validate_extensions' => ['png gif jpg jpeg'],
        'file_validate_size' => [7500000],
    ],
];

After the files are uploaded, AJAX alters the form and it displays the images uploaded with a Title and Description field. Once all fields are filled out the user submit the changes. In the submitForm method, all information is saved as a image content type.

public function submitForm(array &$form, FormStateInterface $form_state)
{
    $values = $form_state->getValue(['upload','images']);

    for ($i = 0; $i < count($values); $i++) {

        $node = Node::create([
            'type'        => 'image',
            'title'       => $values[$i]['image']['title'],
            'field_image' => [
                'target_id' => $values[$i]['image']['fid'],
                'alt' => $values[$i]['image']['description'],
                'title' => $values[$i]['image']['title'],
            ],
        ]);

        $node->save();
    }
}

The node is created and the title is passed, but the image is not. Is the target_id not the fid of the image?


texts: Views: how to remove ending zeros from decimal field

texts:
Suppose, we have a view with a decimal field:

It is output like this:

5 000.000

Is it possible to remove the ending zeros, so it looked like this:

5 000

But if there are meaningful values in the field, it should output all of them. For example:

5.100 -> 5.1
5.010 -> 5.01
5.001 -> 5.001


texts: Deleting feature[]=logo from .info file, enlarged the whole website font-size?

texts: During the theme learning I deleted the feature[]=logo line from .info file  to check its effect at UI. As  expected it got deleted from the toggle list at appearance->theme->toggle option. But simultaneously font-size of whole site got increased, I re-wrote the feature[]=logo in .info, saved, cleared cache, but no effect. Something wrong has happened, has anybody experienced this? I am searching but not getting such kind of issue.


texts: Add extra html to ubercart cart and checkout pages

texts:
I need to wrap ubercart cart, cart/checkout and other front-end pages in extra html, but cannot find a way to do it (some template files or way to add my extra html).

For example, mydomain/cart ubercart content is inside

, and i need to add more html before and after that div.

I could watch for ubercart in page.tpl.php with current_path(); and on occurance add that extra html, but would like to know is there any more propper way.

Update: it is Drupal 7 with Ubercart 3


texts: Helllllloooo guys my website is having weird problem as only admin can subscribe in webform news letter subscription , click to add cart in ubercart, but it's not possible for normal anonymous users or any other roles,  even anonymous users can't register. Actually problem persist to every subscribe type button. My website name is www.f-trend.com.


texts: How to catch various Guzzle exceptions in s3fs module?

texts:
In working on a site with the s3fs module, we have encountered various scenarios that cause page loads to fail with the error, The website encountered an unexpected error. Please try again later. The causes have varied: outbound proxy authentication issues, wrong or missing s3 authentication in the settings.local.php, network failures, etc.. I'm now working on recreating and tracking down some of those issues in the hopes of catching the errors before they cause the page load to fail with an error message in production.
As an example, to simulate an error I truncate the s3fs_file table, clear cache, and remove the settings.local.php file, then try to load the front page, I get the error above. When I look in the error logs, I see:

GuzzleHttp\Exception\ConnectException: cURL error 35: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to foo.amazonaws.com:443 (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in GuzzleHttp\Handler\CurlFactory::createRejection() (line 202 of /home/appuser/app/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php).

I tried adding debug() before that line. When I then look in the error logs, it turns out to get called a bunch of times before finally failing. For the call just before the site returns the error, it looks like the request to AWS and subsequently Guzzle originates within getS3Metadata:
…
#18 /home/appuser/app/web/modules/contrib/s3fs/src/StreamWrapper/S3fsStream.php(1211): Aws\AwsClient->__call('headObject', Array)
#19 /home/appuser/app/web/modules/contrib/s3fs/src/StreamWrapper/S3fsStream.php(1071): Drupal\s3fs\StreamWrapper\S3fsStream->getS3Metadata('public://styles...')
…

It seems the earlier calls generate an S3Exception error, which getS3Metadata is set up to catch. The problem is that I've tried every variation I can think of or find reference to but I can't seem to catch GuzzleHttp\Exception\ConnectException. I've tried switching the catch from S3Exception to \Throwable which continues to catch the the S3Exception but still doesn't catch the Guzzle's ConnectException.
First, what am I missing? Second, am I going about this the right way or should I just resign myself to there being unanticipated failure scenarios and use something like the Error custom pages module to present a slightly more pleasant error page to the user?


texts:
I created a test account and added it to a numer of roles. Some of those roles (not all) have permissions to create content. I am unable to create or edit any content, but am able to view all published content.

When I log in as user/1 I am able to create new content.

What permissions am I missing in order to be able to create new content when logged in as a newly created user?


texts: How can I display Drupal comments on a separate page from hook_node_view()?

texts:
I have a custom implementation of hook_node_view() that changes the display of comments on every node. I would like to know how I can get the result of this improved hook_node_view() to be displayed on a separate page.

Each node should have its own comment page.

I have tried doing this with the Views module, but it seems bypassing hook_node_view(), which makes sense. So I'm still brainstorming on a way that can make this possible.


texts:
I want to create a Basic page that, in addition to its title and body, has a list of other nodes. The list of other nodes has to be entirely administered through the admin. However, I don't want to add the other node field onto all Basic pages, as it only applies to this one specific case. How do I do that?

To clarify, I'm asking about the backend portion of this. How do I get it so that, when I edit a certain node, only specific fields show up in the admin?


texts: How to programmatically add options to list_text field

texts:
I want to programmatically add a drop down list field to the user profile via a custom module. How do I go about adding select options for the field?

// Create Field
'suffix' => array(
  'field_name' => 'suffix',
  'type' => 'list_text',
),

//Create instance
'suffix' => array(
  'field_name' => 'suffix',
  'entity_type' => 'user',
  'label' => 'Suffix',
  'bundle' => 'user',
  'options' => array(
   '0' => 'Mr.',
   '1' => 'Mrs.',
  ),
  'widget' => array(
  'type' => 'list_text',
  );
),

The field shows up but the options do not. Anyone have a good guide they know of or tell me what I'm missing?


texts:
I have a Webform that has an option for a number of tickets. Depending on the number of tickets I need to take information for each ticket, which I was thinking would be the entity?

So if they pick 2 tickets I will need to show the fields some how for the information to then be taken twice.

Any help?


texts: How to work around server limitations on form size?

texts:
I have a form pretty similar to one you can see on your own sites under http://example.com/admin/people/permissions - that is, rows with checkboxes. A lot of checkboxes. I used this code to count them:

console.log(jQuery(':input').length)

Now, when page contains 1858 of them, everything works all right. But one more row makes it 1874. 16 fields per row is not much, and I do need to have all these rows on one page, for draggable to work. And after all, about 115 rows (plus some non-row config) does not sound that big, if you think about it. Sadly, it is too much for my server.

If there is one row too much, request is sent, but it reaches the server stripped from it's POST data. This makes Drupal to just re-send form page, as if user just hit refresh on his browser.

Is there any Drupal method to go around it and send data in parts? Or only send rows that was actually interacted with?

Note

If I'll add enough roles to push built-in permission page over about 2000 inputs, it exhibit exactly the same behavior.

I know I can increase allowed sizes server side, I even found how. But I'm looking for a way to avoid that need.


texts: After enabling repeat date on node, calendar won't show repeated dates

texts:
I made a calendar view that displays all my events. When I created the view the content type Events wasn't enabled for repeating dates.

But now I do want repeating dates, so I enabled the repeat date modules en settings in the content type.

So when I input repeated dates it shows correctly in my node buildmodes but it doesn't show the repeats in my calendar only the first one. Can I still change the calendar to display repeated dates?

Thanks in advance

UPDATE

There's an issue in the date module
The last solution is for drupal 6 I think because I can't find Global Settings of 'Number of values as 1' in Drupal 7
http://drupal.org/node/1391464

solution

I had to delete my field_event_date and recreated to be repeating
I only lost my dates instead of my full nodes.


texts: How to set viewing of Bookmarks User Profile tab to just the owner?

texts:
So, with the Flag module comes a ready made flag and view for "Bookmarks". The view that comes with the Bookmark flag creates a tab on the user profile page labeled "Bookmarks" showing all of the bookmarks saved by that user.

I would like this tab to only be visible for the actual owner of that user profile page.

That way, if some other user views a different user's profile page, they will not see the Bookmarks tab.

Currently, from what I can tell, a view can only be limited in access by Roles or specific permissions. Any suggestions?

I would prefer now to have to use custom PHP.

Drupal 7.12


texts: How to manually make sure the database schema is right?

texts: I updated my drupal installation to 7.7 and now it keeps giving me an alert that the database schema needs to be updated for views and google analytics. I click on it and follow the onscreen instructions and there are NO errors, and the message is still there. Can I manually make sure the schema is up to date and deactivate the warning message?


texts: Allow anonymous user to search custom account field

texts:
I have a custom account field called license number.

How do I allow anonymous users to search for that license number and, after they select it, view that user's profile?


texts:
I'm sending order confirmation messages via the module message-notify. As mail system i'm using MimeMail.
Is there a possibility to add an attachment to the email with the key: commerce_order_order_confirmation?

I tried to add the attachment in hook_mail()

function mymodule_mail($key, &$message, $params) {

    if(isset($key)) {
        if($key == 'commerce_order_order_confirmation') {
            $attachment = array(
                'filecontent' => file_get_contents(DRUPAL_ROOT . '/sites/default/files/pdf/myattachment.pdf'),
                'filename' => 'myattachment.pdf',
                'filemime' => 'application/pdf',
            );

            $message['params']['attachments'][] = $attachment;
        }
    }
}


texts:
Im looking for a module that allow to add fields to users profiles, with the same functionality and flexibility of CCK for nodes; I've actually activated the profile module, but the fields type doesnt fit my needs.

For example, i need to have a node reference field on my users (for nodes that they belongs to - follow), but in general, profile's fields doesnt allow multiple values at all..

I've tryed content profile module, i guess will be my last choice, i dont like to have the user profile and the profile node as two separate entities.. and look a bit overlìkill for me.

Any idea?


texts:
I have a website build with Drupal 7 CMS and I am using the Submenu tree module. Everything was working fine for months, but few weeks ago I have received a feedback from the client that all the links of sub and sublink content was disappeared. I have checked my local version of the website, and there are no any links also.

I have tried to use the same module on another local Drupal 7 website and the result is the same - no matter how I try to set it up - it does not show any sub or sublink content links.

Does anyone has the same problem? Anybody using the same module - can you confirm that it works fine with your website ?


texts: Having username as a path - Profiles 2 and Pathauto

texts:
I have a problem with integrating the Pathauto and Profiles modules. Basically, I would like to have the username as URL, e.g. example.com/username. This should link to the profile page (not the account page). I know how to do it for account ([user:name]) however this method does not work for the profile patterns. There is only certain number of patterns available for profile paths and no username I am afraid. I tried node:author:name, but this doesnt work as well?

Can anyone help with this, or suggest any other solution?


texts: Parent term doesn't show child term entities

texts:
My website has  two taxonomies school and city, are connected.
Here's city term list

Newyork(parent)
-Yonkers(sub-term)
-Albany(sub-term)
-New Rochelle(sub-term)
-Utica(sub-term)

And school term has a city_field connected (with term referenced) to city taxonomy.
 I can list schools according to city terms(eg:newyork schools)

Problem:
All city terms show  schools. That's ok. But parent term(newyork) doesn't show subterm(Yonker, Albany, New Rochelle,Utica) schools.

Newyork (parent term) shows schools if only newyork selected. It should show other city schools under newyork.

What I did:

I've tried to add parent relationship, no result. I've tried to add parent relationship to contextual field, taxonomy term:name field and criteria and many combinations. No result...

Here's view structure:
I've done with prkos help term to term relationship view . You may check here if you want to see how it'shandled.

Any help or article guide with this would be awesome . Thanks


texts: Replace frontpage to a page with wildcards

texts:
I've created a page that receives a term name argument and displays a panel with several views which serves content according to this term name.

The thing is, I want to make that page my default frontpage, with a default term, but everytime I try setting it Drupal sents an error message:

  You cannot make this page your site home page if it uses %
  placeholders.

I'm even trying to set the url manually, such as myCustomPage/myCustomTerm i.e. customFrontPage/NaturalUser and it shows the following error message:

  the url 'myCustomPage/myCustomTerm' is not valid or you don't have permission
  to access it.

Is there any other way to change this?


texts: I'm using calendar module and I noticed when browsing web that some words are not translated (e.g. "prev," "next," "day," "week," "month," "year"). Is it possible to write somewhere the translation for these words?


texts: Theming a node teaser to use its content types's custom tpl.php

texts:
I have a page--contenttype.tpl.php in a custom theme that displays a node exactly how I want it to display on its own node page. How do I make it so that the teaser for the node of that type displays the same as it displays in full view?

I want to add this in either template.php, page.tpl.php or page--contenttype.tpl.php of my custom theme but cannot figure out the best way of doing it


texts:
I am building a form using data so it will be dynamic. I have done all the work in a PHP only way eg. I have built the HTML dynamically including checkboxes which need to be submitted as a form.

My question is how do I include the HTML to pass to the screen in a dynamic form?

eg.

$result1 = db_query('select tid, name from {taxonomy_term_data} where vid = :uid order by tid', array(':uid' => '6'));
$str = '';

foreach ($result1 as $record1) {
    //get date ordered request for each course
    $result2 = db_query('select * from {pd_course_request} where course_description_vocab_id = :tid order by timestamp', array(':tid' => $record1->tid));
    $str .= '
' . $record1->name . '
';
    if($result2->rowCount()>0){
        $str .= '

                        Date
                        Name
                        Email
                        Resolved

';

        //list all request data
        foreach ($result2 as $record2) {
            $str .=     '

                        ' . gmdate("d / m / Y H:i:s", $record2->timestamp) . '
                        ' . $record2->name . '
                        ' . $record2->email . '
                        ' . --A DYNAMIC CHECKBOX HERE-- . '	';
        }
ETC. ETC. ETC.....
return $str;

Will building a form this way work?
How do I pass the dynamic fields and HTML back if not?

cheers,
George


texts: Google map in jQuery UI tabs / Drupal behaviors.js

texts:
As you can see here the google map in the first jQuery ui tab loads correctly but the same map in second / third etc tabs does not load properly or loads off centre.

As mentioned here the problem is that "Any component that requires some dimensional computation for its initialization won't work in a hidden tab, because the tab panel itself is hidden via display: none so that any elements inside won't report their actual width and height (0 in most browsers)."

I have read for example here that the problem is that the map loads after the jQuery UI tabs and so I need a jQuery snippet in my (Drupal 7) theme's behaviors.js to to make the map load before the jQuery UI tabs.

(Please note that the alternative solution of applying CSS to .ui-tabs .ui-tabs-hide  will not work for me because it causes problems elsewhere.)

Can anyone please tell me the code I need for my-theme.behaviors.js ?

my template.php =

<?php
function whitecross_160614_preprocess_html(&$variables){
// some comment here
    drupal_add_library('system', 'ui.tabs');
    drupal_add_js('jQuery(document).ready(function(){
                jQuery("#tabs-x, #tabs-y").tabs({event: "click"});
                jQuery("#tabs-x, #tabs-y").tabs().addClass("ui-tabs-vertical ui-helper-clearfix");
                jQuery("#tabs-x li, #tabs-y li").removeClass("ui-corner-top").addClass("ui-corner-left");
            });',
        'inline');
}

HTML =

Map 1

Map 2

Map 3

<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d2483.645966939501!2... width="800" height="600" frameborder="0" style="border:0">

<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d2483.645966939501!2... width="800" height="600" frameborder="0" style="border:0">

<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d2483.645966939501!2... width="800" height="600" frameborder="0" style="border:0">


texts: How to pass a nid to panel, and load a node with the given nid as context?

texts:
The panel has a custom path, Like this: http://example.com/mypanel/something/theNID/something_else

So the arguments to the panel are:

something
theNID
something_else.

How can I load a node with some variable nid (theNID in this case), and have it available as a context in the panel, and then, make all of it's fields accessible directly in that panel?

If I create a view and load the node (with theNID) within the view, the view won't pass the loaded node as context to panels.


texts: How to display Webform label Above the field instead of Inline in Drupal 8?

texts:
In Drupal 7 it was easy to select whether I wanted the label of a field to display Above or Inline with the field.  In Drupal 8 I can't seem to find this feature. I realize this can be done in CSS, but that seems like a kludgy way to do it if there is just a tickbox somewhere that I am missing.

Can anyone point me in the right direction?


texts: How to execute hook_cron after a rule with event Cron maintenance tasks are performed?

texts:
I have a rule with event Cron maintenance tasks are performed.

It is executed when a cron run.

I have implemented hook_cron in my custom module and I want this hook_cron should be run after that rule is executed.

But the problem is my hook_cron executed first and then that rule is executed.

Is there any way to run my hook_cron after that rule?


texts: SImplenews module. Where does the form come from?

texts:
I would like to modify the content of the simplenews form, but where is it being generated from?

<?php print render($form); ?>

I would like to change the "E-mail" wording, for example.


texts: Using a custom view for a taxonomy term page

texts:
Using Drupal 7 and Views 7.x-3.0-beta3, what is the best way to have a taxonomy page use a custom view?

For example, in Path Auto I have a rule that points the URL alias countries/england towards taxonomy/term/44.

When a user visits countries/england I want to display a page created with Views, not the default taxonomy page.

I am populating the menu using Taxonomy Menu which doesn't yet support custom paths in Drupal 7.


texts:
I'm trying to theme the output of a Drupal 8 view to use via a token for email recipients of a YAML form. I'm on the latest Drupal 8 core release and using a Bootstrap subtheme.

I have successfully removed all of the other views markup with the following TWIG theme override templates:

views-view-fields--ts--page_1.html

views-view--ts--page_1.html

views-view-unformatted--ts--page_1.html

For some reason, I keep getting the following markup added:

I have tried using the views UI options to strip HTML and/or customize the markup output and this does nothing. I've also tried using the TWIG filters like striptags, but this either removes the entire views output (a comma separated list of email addresses) or doesn't work at all.

How do I remove
?


texts: How can I have a field value that is the sum of other (decimal) field values?

texts:
I have created a custom content type with three decimal fields. I need to tally these three fields and then wrap the output of each one with a specific data attribute,  stating their respective value as a percentage of the total.

Am new to drupal so if someone could point me in the right right direction as to how best achieve this it would be much appreciated.


texts: Use contextual filter value in a view's header "rendered entity"

texts:
I want to render a Taxonomy term in a Header for a Page view which uses the Taxonomy term as a Contextual filter. I found that I can add an Entity: Rendered entity to the Header of a View, which I can set to display a Taxonomy term, but it needs an Entity ID, and I don't know how to reference the Contextual filter value.

I suppose I can use a Global: PHP or Global: View in the header to achieve this otherwise, but I wanted to know whether I can use the Rendered entity to do this.


texts: How to handle a post request from an external application in Drupal?

texts:
I am integrating with the Stripe payment gateway and I need to be able to handle a post from their server to authenticate a standalone account. I am trying to follow the instructions at https://stripe.com/docs/connect/standalone-accounts

Namely, I need to provide a callback URL which will receive the data I need through request parameters.

https://mydrupalsite.com/callback?scope=read_write&code=AUTHORIZATION_CODE

I need to be able to get the scope and the code value.

Once I have that, I will need to then redirect based on their values to certain pages.

I tried creating a MENU_CALLBACK type menu item with a page callback to handle the parameters, but what I tried didn't work.
Below is the code I tried.

function bh_commerce_stripe_oauth_menu() {
  $items = array();
  $items['bh_commerce_stripe_oauth/callback/%'] = array(
        'title' => 'bh_commerce_stripe_oauth_callback',
        'page callback' => '_bh_commerce_stripe_oauth_handle_callback',
        'page arguments' => array(2),
        'type' => MENU_CALLBACK
  );
  return $items;
}

function _bh_commerce_stripe_oauth_handle_callback($post_parm_args) {
  drupal_set_message(t('_commerce_stripe_oauth_handle_callback: called'));
  drupal_goto('<front>');
}


texts: what is the difference between hook_insert and hook_node_insert? How could I use hook_insert in place of hook_node_insert or vice versa


texts: Globally increase #maxlength attribute of textfield (form api)

texts:
I have thousabds of field for admin to edit data which is saved in db from mobile app. i can fetch those data into text field while editing but drupal having default #maxlength of 128 character but in my case i have data field which is more than 128 character so its creating problem while saving those data in db. Pls help..
i tried to hack drupal core by writing code in from.inc.

function theme_textfield($variables) {
   $element = $variables['element'];
   $element['#attributes']['type'] = 'text';
+  // Remove maxlength when it's too long to be useful.
+  if ($element['#maxlength'] >= 128) {
+    unset($element['#maxlength']);
+  }
   element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength', 'placeholder'));
   _form_set_class($element, array('form-text'));

but it dint work. pls tell me any solution.


texts: create online "diagnostic" questionnaire with results based on choices

texts:
Is this possible to achieve in drupal 7?
The example I found is here http://www.hairloss-research.com/alopecia-areata-diagnosis/

I tried to use webform module or quizz module but no luck. Thank you for answers.


texts: How to add a new responsive Layout for large viewports to Omega Theme

texts:
I would like to add another Layout to the Omega-Theme Settings, because i need a certain media-query for an extra-large viewport. I tried adding a new setting to the .info-file but without success.
Maybe this will be possible only by adding a new media-query directly to the css-file?


texts: How to theme multiple entities on the same page?

texts:
I am trying to write a module that displays several entities in one page, but I don't see how I should theme them.

I've found (an mostly followed) this: https://drupal.org/node/1238606.

But the point where I get stuck is the return value of the page callback. The link above suggests:

function my_entity_page_view($entity, $view_mode='full') {
  $entity_type = $entity->entityType();
  $entity_id = entity_id($entity_type, $entity);

  $entity->content = array();
  $entity->title = filter_xss($entity->title);

  field_attach_prepare_view($entity_type, array($entity_id => $entity), $view_mode);
  entity_prepare_view($entity_type, array($entity_id => $entity));
  $entity->content += field_attach_view($entity_type, $entity, $view_mode);

  $entity->content += array(
    '#theme'     => $entity_type,
    '#element'   => $entity,
    '#view_mode' => $view_mode,
    '#language'  => LANGUAGE_NONE,
  );
  return $entity->content;
}

I however try to load several entities at once and have no fields, so I tried this:

$entities = // Array of entities keyed by id;

entity_prepare_view('entity_type', $entities);

$return = array(
  '#theme'     => 'entity_type',
  '#element'   => $entities,
  '#view_mode' => 'full',
  '#language'  => LANGUAGE_NONE,
);

return $return;

Since entity_prepare_view() accepts an array of entities, I'd suppose there should be a way to theme several entities at once as well. Or am I wrong?


texts: redirect after login in drupal without impacting the password reset functionality

texts:
The problem:

When using hook_user_login to redirect a user to the correct language this is also triggered during password reset. And the hook params do not provide a way to deal with this.

This How can I redirect users on login based on their chosen language? post details multiple not working concepts.

And i can't comment cause of the silly reputation thing, while i'm a developer for over 10 years... (getting tired)

I guess the form alter is the ONLY way.


texts:
how can I assign my own html.tpl.php to a view (machine_name) via a preprocess-function (template.php) or a hook?

If my view is called "foo_view_machine_name_bla", which contains 50 views-pages with path, I would like to have a "html--foo_view_machine_name_bla.tpl.php".

I do not know songs how to do that.

Can someone help me please.


texts: Clear cache after save orders using draggable views in Drupal 7

texts:
I've used Draggableviews 7.x-2.1 module to enable drag & drop options for particular views. It works well.

I've enabled cache for Anonymous users. Due to this, after save the ordering, the changes didn't affect orders for Anonymous users.

So I've tried to clear cache after submitting handler of draggable views. I've used below code:

function phponwebsites_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_form_test_views') {
    $form['#submit'][] = 'phponwebsites_draggable_custom_submit';
  }
}

function phponwebsites_draggable_custom_submit(&$form, $form_state) {
  print_r('ss');exit;
  drupal_flush_all_caches();
}

But my custom submit handler doesn't call. Is any other solutions?


texts:
Required functionality:

User can filter nodes based on certain relevant custom fields.
User can save filter criteria as a named set.
User can view and edit these sets of filter criteria.
User can "subscribe" to changes based on his saved sets of filter criteria and get email notifications containing links to only the newly matching nodes.

Can I build such subscriptions with mostly out-of-the-box functionality of Rules and related modules?

Subscriptions depending addressfield field is a related question, but the poor lad did not get an answer.


texts: add a search field which search for values of specific field in a content type

texts:
I've created a content type "Submission", which have many fields. One of them is "ID".

Now, I need a search box (apart from regular search box). It should be searched with ID value, it should display search result of content which have this ID value.

Any suggestions please.


texts: Crumbs module won't display correct current page. Displays 'Anchor'

texts:
I am using the crumbs module to create a breadcrumb for my website. I have the 'Show the current page at the end of the breadcrumb trail.' setting enabled however on one of my pages the current page is getting replaced with the word 'Anchor', instead of of Home>Products>'Lambswool Dusters'

Does anyone know where this is coming from? The name of the page is correct and all of my other breadcrumbs are being generated properly.

I might also add I am generating the urls using taxonomy terms and I do have page anchors on the page.

Output I am getting.


texts: How to move Composer created folder of drupal-8.x.x up one level to html?

texts:
So I created a fresh install of Ubuntu 16.04 and installed the LAMP stack, installed phpmyadmin and composer and then finally drush. Everything worked fine until I downloaded and installed Drupal using the "drush pm download" command which worked fine but now my entire drupal site is located in a folder called "drupal-8.6.3". I used to use the wget command and the tar --strip components command to get it properly organized.

I can delete the drupal-8.6.3 directory but how can I download my drupal site using composer or drush from the html folder?


texts:
I am having a peculiar error where whenever I click on the People tab on the admin bar it is redirecting me to the homepage.

Could someone please shed some light on this? This is on the live server for a while now, but this issue just recently started occurring.

Cheers.

P.S. I am superadmin, so I should have all the privileges.


texts: How can I assign a block to a region programmatically?

texts: In Drupal 8 I'm trying to set programmatically a block created with Views to a region, does anyone how to do it?


texts:
I'm attempting to create a site that lists my brother's DVD releases.

I've been able to do this with Views, but I would like a more user friendly interface so I don't have to administer the site in the future, and my brother can do it himself.

Basically I have two Content Types:  Releases, and Scenes.

When creating a Release, I want (my brother) to be able to select Scenes that have already been added, and arrange them in a specific order as though they are a Custom Field in the Releases Content Type.

I don't think Views out of the box is friendly enough for my brother.

Any ideas, modules, hints, or search keywords that might help me engineer a solution?


texts: In Drupal 8 view.html.twig file how do I access the view content such as individual field title and/or field content?

texts:
Using views-view.html.twig as a starting point, I can output {{ rows }}, but I want to loop through each field of each row to aggregate and style them.

In Drupal 7, I use dpm(rows) to locate (in the array) where content, label etc. But kint doesn't seem to provide me the same information. Can anyone help?


texts:
I'm using Drupal 7.34 (will be updating soon) and the latest version of Panels for 7x.

When I use the Panels Dashboard (admin/structure/panels) and click Panel Page to create a new panel page, I am redirected to the Structure section immediately.

Most of the other options do the same thing, specifically: Custom Content, Custom Ruleset, and Custom Style.

Here are the modules I'm running: Panels 3.5, CTools Suite 1.7, Views 3.11, Advanced Help 1.2, Open Graph 1.3, Page Title 2.7, Global Redirect 1.5 and XML Sitemap 2.2.

I have cleared caches, and have checked permissions to ensure they are enabled, and I haven't seen this issue come up in the Known Issues. Every required module appears to be activated, though I have not activated Panels Translation.

I'm more or less a Drupal novice, so please, if you have time to help, I would be incredibly grateful.

Thanks!


texts: limit db_select query by the value of a specific field

texts:
I am trying to build a custom drupal module to return the 'staff' that work at a specific charity when you are on the page of the charity. Both the charities and the staff members exist as separate content types. These content types are updated dynamically from a CRM system. The charities and the staff members both have a common field 'Account ID'.

I can get the account id of the charity whose page we are viewing:

    //Get Account ID of Charity for page we are on
    $charity_account_id = $node->field_member_account_id[LANGUAGE_NONE][0]['value'];

I can query the database and return only the contacts of the staff members type ('salesforce_contacts') and optionally limit it by the title of the returned results (e.g: n.title','Abouzeid')

    //Use Database API to retrieve the appropriate contact(s)
      $query = db_select('node', 'n')
        ->fields('n', array('nid', 'title', 'created'))
        ->condition('status', 1) //Published.
        ->condition('type', 'salesforce_contacts') // content type is salesforce_contacts.
        ->condition('n.title','Abouzeid','=') // I can limit the returned results by a specific title
        ->orderBy('title', 'ASC') //Most recent first.
        ->execute();
      return $query;

I need to know how to limit the returned results by the value of a specific cck field from the staff member content type ('salesforce_contacts'). This will allow me just to return the contacts for the charity we are looking at.

I have tried adding the drupal machine name for the field (or the mySQL database table name) to the field array as in below but both of these throw a PDOException error.

      ->fields('n', array('nid', 'title', 'created', 'field_account_id'))

I would really appreciate some help with this. This is my first Drupal database query and I am pretty new to DB queries in general. I have tried reading through the documentation but am struggling to where to look to get ideas as to how to go about achieving what I need to.

Thanks.


texts: How to show message before buy when user has in OG group and product SKU?

texts:
I have a small problem with Drupal commerce rules. I want to achieve showing message before buy a product with a specific SKU and when the user is a member of a specific OG group (whose group is created by a node age group).
But I don't know how to configure rules to check user OG group id and product sku.

My rule, export is below:

{ "rules_only_one_purchase" : {
    "LABEL" : "Only One Purchase",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "og", "rules_i18n", "commerce_cart" ],
    "ON" : { "commerce_cart_product_add" : [] },
    "IF" : [
      { "entity_is_of_bundle" : {
          "entity" : [ "commerce-line-item" ],
          "type" : "commerce_line_item",
          "bundle" : { "value" : { "product" : "product" } }
        }
      },
      { "AND" : [
          { "og_entity_in_group" : {
              "entity" : [ "site:current-user" ],
              "group" : [ "site:og-context--node" ]
            }
          }
        ]
      }
    ],
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "site:current-user:og-membership" ] },
          "ITEM" : { "list_item" : "Current list item" },
          "DO" : [
            { "component_rules_check_user_og_group" : {
                "loged_user" : [ "site:current-user" ],
                "user_og_membership" : [ "list-item" ]
              }
            },
            { "drupal_message" : { "message" : "Test message." } }
          ]
        }
      }
    ]
  }
}


texts: Correct views hook to alter contextual filter

texts:
I am trying to find the correct views hook to alter/add a contextual filter to a views block that's being rendered in a template. (Using drupal_view and the twig tweaks module).
The view is setup to accept a contextual filter that is provided in the URL by default. It works great on that page, however it's been requested that the view also display on a sub-page of this main page, in where the URL does not contain the contextual filter. Therefore, I am trying to find a views hook that I can reliably attach the contextual filter to and have it work every page load.
I have tried using hook_views_pre_view(), however this appears to only work once between cache clears, as if I clear cache it works, then as soon as I refresh the page it stops working again until another cache clear.
Is there a way I can do this from a hook? The way the child-page is structured, I can't easily get it from the template to pass it into drupal_view() as an argument.
The current code I am using is:
function item_types_views_pre_view(&$view, &$display_id, &$args) {
    if ($view->id() == 'existing_copies') {

        $parameters = \Drupal::routeMatch()->getParameters();
        $imcid = \Drupal::routeMatch()->getParameter('imcid');

        $entity = \Drupal::entityTypeManager()->getStorage('item_type')->load($imcid);

        if ($entity->bundle() == 'book_copy') {
            $main_record = $entity->field_book_main_record->getString();
        }
        elseif ($entity->bundle() == 'book_master_copy') {
            $main_record = $entity->field_master_copy_book_mr->getString();
        }

        $args = [$main_record];
    }
}

Which like I said, works great immediately after a cache clear, but no longer works after the page is refreshed.


texts:
Im slowly getting back into Drupal after much time away and beginning to pick it up and the learning curve is building back up.

So much so I always like to throw out pre-defined conventions as too restrictive while keeping the rough framework to build something bigger for what I want to do.

In my case, it's a scheduler program. But mine is in the context for a church, but could work equally well elsewhere

However the idea is that each type can have a sub type, a schedule gets applied to the type and the back end calendar generates the calendar entries for the schedule. This then gets displayed in a number of ways, from an eventually RSS feed to hook into an Android application, to a Calendar and everything else in between.

Each calendar item needs to be overwritable in that it's a generic item that may have additional certain applicable details rather than being a unique entity in its own right.

This list of types should be output with a link then to each type while I alter the page then to generate a list of next upcoming schedules for that item. Click on a date and get entries for that date. etc

It's all going pretty well until I realise I need to start referring to things by database Id instead of having a nice URL because frankly, database calendar entries don't as such have a nice URL.

One of the things I would have liked to have done is to have a URL alias against a node for my event type, eg, somecategory/sometype but then to be able to use the hook_menu system to get somecategory/sometype/% (where % could be sun, mon, tue, wed etc). Bearing in mind somecategory, sometype will be variable depending on user input, only % will have a list of specific possible - sun throu sat.

Trouble is, it doesn't look like you can do it, so I've just had to use an alias such as calendar/type/%

Any thoughts on this hook_menu issue, and any thoughts overall? 2000 lines of code into this thing and Im wondering why Im doing this (oh yeah, I like doing things my way).

Simon


texts: View showing Teasers - getting path for full content in teaser template

texts:
I have created a simple view to list teasers of a particular content type.

I'm then using a simple view template, modified to suit the layout needed.
In the content type set-up there is not an option to display the path/URL to the full content. I can set the image if output to link to the original content, but I can't seem to find an option to just get the URL for the full content so I can link the whole teaser block to the full article.

Any clues? Know this should be easy - but can't seem to find it.


texts:
So I have the following infrastructure (that cannot be changed):

A central repository
A ton of drupal websites that automatically pull via anacron

Right now, I'm trying to keep the modules in this repository up to date. Typically, I replace the module directory, commit the changes, and push to the repo. Then, all the Drupal sites in our kingdom pull changes. Everyone's up to date, and we all go on with life.

However, I have a module to update that requires update.php to be run. I do not want to chase down upwards of 50 people to get them to run this script. Is there a way to force Drupal to run update.php for me? As part of our policy, we have protections set on update.php so I can't do it through the browser. Ideas?


texts: Getting WSOD after attempting to upload an images from desktop

texts: I am unable to upload an image from my desktop in Drupal 7. I am trying to upload an image to a blog without using Ckeditor.  I have created a field for the image and assigned it as image.  All looks good. The problem happens when I go to create a new blog, I see the field for the image. I click on the "Choose file".  It brings me to my desktop.  I select the image and then click onto "Upload". The small blue wheel begins to spin. Then I get the WSOD. I see, in Firefox, at the bottom of the page "Transfering data from XXX.com..."


texts: How to display a specific field instead of Title with Entity Reference

texts:
I Have two entities.

**Students**
Title
Body

**Cours**
Title
Body
CoursRefNumber

I can associate many Cours for each students.
To do that, I create a Entity Reference on Cours for student.

When I create a new Student, I see al the Available Cours List.
Instead of showing Title In the Listbox, How can I display the CoursRefNumber .

Thanks a lot.


texts: How to add the VAT on the selected products in Commerce Kickstart?

texts: I am using Drupal commerce kickstart. Can anyone tell me how to create the field for the VAT in the product creation form? I need a field for each product listed in the product form.


texts: Administer Users by Role module - show users

texts:
I'm using Administer Users by Role module and I crated a view of users.
That view displays all the users.
Lets assume there is 'Admin', 'Editor' & 'Member' roles.
Admin can see all the users.
Editor can see only Members (not other Editors and not the admin).
I need that so I can use Views-Data-Export module.

How to create such a view? or any other suggestions?


texts: remove fivestar rating from $print['content'] in print module

texts:
I installed the print module. But in the print view, the fivestar rating of the node is shown. How can I remove it?
It seems to be in $print['content']. Any help appreciated.


texts: How do I programmatically install and enable a module?

texts:
There is a lot resource for doing it in Drupal 6, but I didn't find a solution for Drupal 7.

How can I install and enable selected modules?


texts: Storing Credit Card Information for later use

texts:
I'm building a website where registered users would place future order(s). e.g. after 6 months for $20, or even on a specified date may be after one year or so.

In order to charge them on those transaction dates through paypal or any other payment gateway, we would need their credit card information to store somewhere.

What is the best way to complete the task with maximum security.

Please advice.

Edit: Currently I'm using Ubercart, but if any other module can fit for the required scenario, I'm open for that.

These would not be recurring payments, but I would rather call them "post-dated orders". I've never used any payment methods. This is my first site for shopping cart so I've no idea. If paypal can store the CC info for multiple transactions for every site member and give me option to execute the orders on specific dates, I hope that would be fine with me too.


texts: Concatenate two fieds in an EntityQuery condition

texts:
I'm trying to query some nodes by a given string checking if the string is either in the node title OR if the string is an exact match of concatenating the value of two strings.

I know this should be possible in normal mysql but not sure it can be translated in an entity query. Has anyone stumbled upon this problem before?

Is there some sort of 'free text' condition which is not tied up to fields.

At the moment the below code complains about the fact that CONCAT_WS(...) is not a field which is true.

Maybe there is a simpler solution to this but I'm just not seeing it.

$query = \Drupal::entityQuery('node')
        ->condition('status', 1)
        ->condition('type', 'CONTENT_TYPE');

$group = $query->orConditionGroup()
        ->condition('title', $string , 'CONTAINS')
        ->condition("CONCAT_WS('',FIELD_1,FIELD_2)", $string);

$query->condition($group);
$nids = $query->execute();


texts: Populate and submit “content creation” form programmatically?

texts:
I have simple database table with two fields "Title" and "URL".

Can we pull the values from database table programmatically and populate the above form with "Title" and "URL" and finally submit (save) it programmatically.


texts: How to make menu link show for certain roles?

texts:
I want to add "Login" and "Logout" to the same menu but only for the right role. In previous versions of Drupal, you would just add /user/login and /user/logout to a menu and it would only render one or the other based on if they actually were logged in or not.

However in D8, it looks like the Logout link shows regardless... is there a way to replicate this without creating multiple menus?


texts: Entity Reference - am I using it correctly?

texts:
I need a bit of help with entity references. I have Customer Profiles entity and Credit Card entity. I'd like to be able to create "credit cards" and attach them to customer profiles so that if I click hte customer profile, I'd see any credit cards attached to them. I'm not sure how to do this. I've created the credit card content type, added a reference field to it that references the customer, but I'm not sure how to display the filtered credit card entries on the customer profile. I've tried adding an entity reference field to the customer profile back to the credit cards but don't know how to filter the results.

My brain hurts a bit at this point.


texts: Adding html to t() in Drupal 6 template.php?

texts:
Hi I am trying to add html to the "t('Older Posts')" and "t('Newer Posts')" Is this possible ? I can figure it out ????
I am in a Drupal 6 template.php file.

This is the code I am trying to add as html -

 Newer Posts
 Older Posts

I need to replace the above in these spots located in the full function below ?

 t('Older Posts')
 t('Newer Posts')

I want to create something like this

 t('Older Posts')
 t('Newer Posts')

Full Function

 function theme_views_mini_pager($tags = array(), $limit = 10,
 $element = 0,  $parameters = array(), $quantity = 9) {
 global $pager_page_array, $pager_total;

 // Calculate various markers within this pager piece:
 // Middle is used to "center" pages around the current page.
 $pager_middle = ceil($quantity / 2);
 // current is the page we are currently paged to
 $pager_current = $pager_page_array[$element] + 1;
 // max is the maximum page number
 $pager_max = $pager_total[$element];
 // End of marker calculations.

$li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] :
t('Older Posts')), $limit, $element, 1, $parameters);
 if (empty($li_previous)) {
$li_previous = "&nbsp;";
}

$li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('Newer Posts')),
$limit,$element, 1, $parameters);
if (empty($li_next)) {
$li_next = "&nbsp;";
}

if ($pager_total[$element] > 5) {
$items[] = array(
  'class' => 'action back pager-previous',
  'data' => $li_previous,
);

$items[] = array(
  'class' => 'action pager-next',
  'data' => $li_next,
);
return theme('item_list', $items, NULL, 'ul', array('class' => 'pager'));
}
}

I am trying to figure out if this is possible I have tried many things and nothing has worked yet.


texts: What does the project: key in module.info.yml do?

texts:
Note: this is not the book module from core.

I inherited a custom module that was not written by me. Its .info.yml contains a project: key which I have never seen ever before.

ps_book.info.yml

name: Book
type: module
description: Provides lesson page structure
package: Pivotal Science
dependencies:

version: '8.x-1.0'
core: '8.x'
project: 'ps_book'

I noticed that when I install the module I get 3 errors in the log.

I did a mouseover, so you can read the full error. The other two are the same except they end in es.po. and fr.po.

In Let Drupal 8 know about your module with an .info.yml file I couldn't find any mention of the project: key.

If I remove the project: 'ps_book' line, I no longer get those 3 errors when I install the module.

Is there any official doc for this key? If not, should someone add it the docs?


texts:
I want to alter some data on preview page of Webform and I want to add Tpl for it .
How can I theme for Webforms preview page , and what's the Tpl for it ?


texts:
Authenticated users must be able to flag webform submissions.

How can I make this work?


texts: Adding a class if views search facet has been used

texts:
In a Drupal 9 with Search APi and Facets the aim is to make the views search api list with all items (lets call it the 'unused state') in an opaque state (or similar) and the facets in full opacity. This to make it clear, that no filters have been used yet and the user will directly go and use the facets. after using the facets the views result list will appear in full opacity.
I somehow need to generarte classes for one of this states and add a body class (or a class name on the view), so that I can do that.
Cant get my head around how to check for that state. Could do it with empty blocks maybe or the state of the url maybe (url being ..../f*  if facets were used)
++++++++++++++++++++++++++
EDIT (some hours later):
Got it done using the 'Page Specific Class' module und passing a body class when the url is the base views url without any appendixes by filters or facets


texts: How to change cache context array for home page

texts:
I have Drupal setup using multisite so that the contents vary with sub domain. I need to use 'url.site' in 'cache context'. But cache context array contains 'url.site' only for node pages. In home page it contains:

Array (
   [0] => languages:language_interface
   [1] => theme
   [2] => user.permissions
)

I think overriding function getCacheableRenderArray() with the below code will fix the issue.

if (!in_array('url.site', $elements['#cache']['contexts'])) {
  $elements['#cache']['contexts'][] = 'url.site';
}

How can I override the above mentioned array values using Drupal's default method?


texts: How to support legacy url alias' and/or support multiple url alias' (Conditional Pathauto?)

texts:
I am migrating a site from wordpress and need to preserve my url structure whilst supporting native pathauto urls in the future (for new content)

Overall Drupal's clean url process is almost identical to wordpress but I am finding some small discrepancies and with around 2k posts to migrate over I need a programmatic way to do this that won't feel like I'm trying to roll a keg up hill.

I was thinking of inserting in the old wordpress url as field_legacy_slug and then I could create paths based on that, but... as far as I know pathauto doesn't have any conditional abilities and I'd want to use a field_legacy_slug only if it exists, else use a standard token based pathauto pattern (site.com/2011-01-01/title-of-post)

I also don't think creating multiple alias' for content is advisable (aka letting wordpress url alias' exist beside the native pathautos) - but I am course asking you for insight into this :)

Creating node paths on import myself and allowing pathauto to catch new nodes seems like my only option but I'd hate for someone to run an "Update path alias" and ruin it all.


texts: Filter |raw doesn't show entity media image

texts:
Using the following code for displaying content from a WYSIWYG field:
content.field_body|raw I only got the text without images added in a editor as media. When I remove filter raw I see <drupal-entity data-embed-button="media_browser" data-entity-embed.... is being displayed as a text but not as image.


texts: on delete of one field delete other field too

texts:
I want to implement some logic using what I can define that one delete of one field delete other related field.

so is there any module available or anythings else using what I can define cascade delete.


texts: Adding price field on Drupal Commerce that affect Order Price

texts:
The case is

When user place an order, shipping price must be manually calculated before the final invoice is sent to user.

What I do

I create Price custom field on Order named shippingfee.

Problem is

How to make shippingfee field affect the Order price?

Another thing that I tried is creating custom line item type. I'm thinking that by creating this custom line item type would update the value.But following this tutorial, the custom line item type did not appear when I check on admin/commerce/config/line-items.

Code added to custom module:

/**
 * Implements hook_commerce_line_item_type_info().
 */
function owemji_commerce_line_item_type_info() {
  return array(
    'owemji' => array(
        'name' => t('Shipping Fee'),
        'product' => false,
        'description' => t('Price of shipping.'),
        'base' => 'owemji',
    ),
  );
}

/**
 * Implements hook_enable().
 */
function owemji_enable() {
  commerce_line_item_configure_line_item_fields(array('owemji'));
}

I did try clear cache and disable -> enable the owemji module, but it's still not there.


texts: Why am I getting this error for the schema I define in my module?

texts:
I'm building a module for Drupal 7, but I have troubles with my schema, and I don't understand why.

This is my schema.

$schema['table_name'] = array(
        'fields' => array(
            'id' => array(
                'type' => 'serial',
                'unsigned' => true,
                'not null' => true,
                'length' => 11
            ),
            'nid' => array(
                'type' => 'int',
                'unsigned' => true,
                'not null' => true,
                'length' => 11
            ),
            'oid' => array(
                'type' => 'int',
                'unsigned' => true,
                'not null' => true,
                'length' => 11
            ),
            'start_time' => array(
                'type' => 'datetime',
                'not null' => false
            ),
            'end_time' => array(
                'type' => 'datetime',
                'not null' => false
            ),
            'duration' => array(
                'type' => 'int',
                'unsigned' => true,
                'not null' => true,
                'length' => 11
            )
        ),
        'primary key' => array('id'),
        'unique keys' => array('id')
    );

I get this error.

  PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064
  You have an error in your SQL syntax; check the manual that
  corresponds to  your MySQL server version for the right syntax to use
  near 'NULL DEFAULT NULL,  end_time NULL DEFAULT NULL, duration INT
  unsigned NOT ' at line 5: CREATE  TABLE {table_name} ( id INT
  unsigned NOT NULL auto_increment, nid INT  unsigned NOT NULL, oid
  INT unsigned NOT NULL, start_time NULL DEFAULT  NULL, end_time
  NULL DEFAULT NULL, duration INT unsigned NOT NULL, PRIMARY  KEY
  (id), UNIQUE KEY 0 () ) ENGINE = InnoDB DEFAULT CHARACTER SET
  utf8;  Array ( ) in db_create_table() (line 2717 of
  /Applications/MAMP/htdocs/project/www/includes/database/database.inc).

How can I fix this error?


texts: Achieve single node field edit to have different values for each user?

texts:
I am trying to create lets say and activity node which allow each user to insert a different value without having to create a node. for example:

I created activity1 node, and then I will allow user a to edit activity1 and insert value "a", and user b can also edit activity1 and insert value "b", and both can see their own activity1(the same node) but with different values for each user.

is this achieveable? as I tried using uniquefields module and that is the one I want for this case.

look forward for some response!

thank you


texts: How to show "field-image" in search page?

texts:
I want make a photo gallery with Drupal.
I have a problem with showing article images (that shows in homepage in a div classed "field-image"), I want show this image is search page.
After searching for something just title and text shows, how to show images there?
Thanks a lot :)
look at this shots:


texts: How to get the revisions list of a node and delete them all?

texts:
Revisions and how to delete them all. For Drupal 7, there’re plenty of modules that do that or even limit the revisions that are kept or even delete everything that is older then x-days, but not for Drupal 8.

It seems there is nothing out there. Searching through the database is something I like not to do.

Any ideas?


texts: Group users and display the group on the profile page

texts:
How can I create a group/role/taxonomy term or anything else to group specific users ? I also want to display the "group/role/taxonomy term or anything else" on the users profile.

For example: I go to example.com/user/1 and I see all of his details AND that he has the administrator-"group/role/taxonomy term or anything else".

Thanks in advance (I am a noob here)


texts: How can I construct an HTTPS POST with drupal_http_request?

texts:
I want to do a post request to an HTTPS server address... I have this example code that demonstrates sending a POST request -

$data = 'name=value&name1=value1';

$options = array(
                'method' => 'POST',
                'data' => $data,
                'timeout' => 15,
                'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
        );

$result = drupal_http_request('http://somewhere.com', $options);

and also on drupal_http_request, there is this code -

case 'https':
  // ***************
  // Note: Only works when PHP is compiled with OpenSSL support.
  // ***************
  $port = isset($uri['port']) ? $uri['port'] : 443;
  $socket = 'ssl://' . $uri['host'] . ':' . $port;
  $options['headers']['Host'] = $uri['host'] . ($port != 443 ? ':' . $port : '');
  break;

to demonstrate sending a POST to an HTTPS connection. Problem is, I can't figure out out to implement the HTTPS options in the POST example code above. Can someone please help me and explain how to do this? I'm quite new to PHP code writing and Drupal and could definitely use the guidance. The drupal_http_request documentation are great as an index, but it doesn't help you a lot if you want to learn things from scratch.

edit-

after your comment's, i got to this code -

    $data = 'access_token=455754fhnaI&href=fb&template=You have people waiting to play with you, play now!';

$options = array(
                'method' => 'POST',
                'data' => $data,
                'timeout' => 15,
                'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
        );

$result = drupal_http_request('https://graph.facebook.com/1000721/notifications?', $options);

but its still dosen't work... if i post via FIREFOX poster with this patten -

https://graph.facebook.com/1000080521/notifications?
     access_token=45575FpHfhnaI&
     href= fb &
     template=You have people waiting to play with you, play now!

it's working... so i am probably not constructing the request properly in drupal... thanks a lot everyone... really hope someone could help me  figure this out...


texts:
I have an image field that allows a single image to be uploaded. The selection works, but if I click upload, I get an AJAX error. If I just submit without uploading first, the image is uploaded properly. If I go in to edit that image field and click remove, I again get an ajax error.

An error occurred while attempting to process /file/ajax/field_front_image/und/0/form-XprUtXJvTcMRlmsz3CmBs6uDFpuJcev4SO_I_PvsM-E: Array.prototype.reverse called on null or undefined

I get this error locally and on the production server. It happens for all image fields and it's the same error when clicking upload or remove.

How can I fix the ajax on these form fields?


texts: Node gallery: display image count in a template file

texts:
I use the Node Gallery API  module (part of the node_gallery project) to create galleries of nodes. Now I need to theme node--gallery.tpl.php to display the count of images in a gallery.

I tried to use the Node Gallery API function called node_gallery_api_get_item_count, but it doesn't work. So I tried to look at the database and indeed the node_gallery_galleries table contains zero values on the item_count and pub_item_count columns (even if I call the function with reset=TRUE).

So how to calculate the value directly from the database?


texts: How to fix drush php configuration on the hosting?

texts:
I am facing a pretty award drush problem. In order to run drush I need to use this command on my hosting:

/opt/php/bin/php -c /home/pisar/etc/php.ini
                 -d memory_limit=128M /home/pisar/opt/drush.php

When I run

/opt/php/bin/php -c /home/pisar/etc/php.ini
                 -d memory_limit=128M /home/pisar/opt/drush.php status

it works correctly. But when I try to do the update command:

/opt/php/bin/php -c /home/pisar/etc/php.ini
                 -d memory_limit=128M /home/pisar/opt/drush.php upc drupal

and it fails with the message:

  pm-updatestatus failed

I found out that upc runs drush in subshell with incorrect php. So I added path to php:

/opt/php/bin/php -c /home/pisar/etc/php.ini
                 -d memory_limit=128M /home/pisar/opt/drush.php
                 --php=/opt/php/bin/php --debug upc drupal

But it also fails without configs. When I pass configs:

/opt/php/bin/php -c /home/pisar/etc/php.ini
                 -d memory_limit=128M /home/pisar/opt/drush.php
                 --php=/opt/php/bin/php\ -c\ /home/pisar/etc/php.ini\
                 -d\ memory_limit=128M --debug upc drupal

it fails because it tries to run them using quoted php with params:

Backend invoke: '/opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M' /home/pisar/opt/drush.php --php='/opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M'  [command]
 --backend=2 --verbose --debug --root=/home/pisar/site.com/docs/drupal --uri=http://default  pm-updatestatus drupal 2>&1 [1.45 sec, 14.72 MB]
'/opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M' /home/pisar/opt/drush.php --php='/opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M'  --backend=2      [notice]
--verbose --debug --root=/home/pisar/site.com/docs/drupal --uri=http://default  pm-updatestatus drupal 2>&1 [1.45 sec, 14.73 MB]
The command could not be executed successfully (returned: /opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M: not found

I put this:

export DRUSH_PHP='/opt/php/bin/php'
export PHP_INI='/home/pisar/etc/php.ini'
export PHP_OPTIONS='-d memory_limit=128M'

into ~/.profile, ~/.bash_profile and ~/.bashrc. Then ran without --php, but nothing helped.

How to fix?


texts: Where can I tell if my Drupal 7 database is using InnoDB?

texts:
I have a Drupal 7 site and was wondering how can I tell if my database is using InnoDB ?

If its not using InnoDB, would I be able to just switch over easily? I just recently switched to MariaDB if that makes a difference.


texts: View with editable-fields and field-collection fields

texts:
I have created a view of profile2 data, somekind like a extended user profile where users can add some personal data and other information of interest. I chose the view because in a next step of development I want to provide a profile search function. Basically I think to choose a View is the right way to go.

So when I (as a owner of a profile) call the view page (filter is set to my login UID, setup as a contextual filter) it shows up and the editable defined fields are all editable (by click). I wanted to provide a profile page view that is in-page editable (eg. functions as a form and a view, all in one). All this works great. Also I can use that view to show to anonymous users (as a search result) the profile content (non editable of course).

My problem are 2 field-collections in that profile that shows (due to the editable setting "Formatter" in the View field definition) both the "add" link and also the "edit this field" of the "editable setting" of these very 2 fields. That is redundant. I seem not to be able to find any way to switch off the second "edit this field" link. If I set these field-collections to the "default" formatter (not editable), I also get no "add" link to add values to the field collections. This is the case if the user just created an account and the collections are empty.

Now my question, how can I remove the "edit this field" link generated by the "editable" functionality? It seems, that JS add these links and I can not remove them anyhow. Is there any way I can override these two fields and remove the link (but still leave these fields in editable state)? Some theme override I could use, or somewhere within the fields template?

I played a little and defined a field template (named by the collection-field such as views-view-field--field-work-experience.tpl.php) and tried to remove the 'edit this link" or JS selector. If I now choose the formatter editable-link, (not the editable formatter) and change the code in the field template to

$markup = $row->field_field_work_experience[0]['rendered']['#markup'];
print $markup;

the "edit this field" from the editable-link module will not show up, but I get the wanted "add" link. The regular field template output

print $output;

will show both, the "add" link and the "edit this field" link.

Well, the first snippet is a dirty hack and a try and it might lead to undefined behavior. I do not like to keep up with that at all.

BTW, I have both modules installed, "editable-link" and "editable". I develop with drupal 7.

So is there any way I can remove these "editable field" links from the field-collection fields and just get the regular link "add".

I hope I described my problem clear enough, if not please let me know I try to explain more precisely.

Any help is greatly appreciated.


texts: How to shift/change timestamp in a scheduled rule?

texts: A scheduled rule was triggered. Is it possible to change a date of the scheduled action? (programmatically or not) For example, the scheduled action will be triggered in 3 days but then you would like to change it for 1 day.


texts: How can I use xx time ago in Drupal 8 comments?

texts:
I use Drupal 8 and want the date of comments just show "xx time ago".

I added this code to mytheme.theme, but it does not work:

function mytheme_preprocess_comment(&$variables) {
/** @var \Drupal\Core\Datetime\DateFormatterInterface $formatter */
$date_formatter = \Drupal::service('date.formatter');

$variables['foo'] = $date_formatter->formatDiff(REQUEST_TIME - 12345, REQUEST_TIME, [
'granularity' => 3,
'return_as_object' => TRUE,   ]); }

And I use {{ foo }} but that does not show "time ago" either. Other things I tried (and which didn't work either):

{{ created|date_modify }}
{{ created|time_deff }}
{{ created }}

Any help/hints about how I can do this?

Note: using the same logic as in my previous question (How can I use 'xx time ago' as date format?) and using MYTHEME_preprocess_comment instead (as suggested by Neograph734) does not seem to work for comments.


texts: Please, help. Is it possible implement different templates for form-element.html.twig? For form 'user-form' one template, and for other forms second template.


texts: View with pagination to have a single url per pagination page

texts:
I was doing a View for a last news from a site, but those news won't be accesible from outside, so only will be able to see the content by the view.

This view has a Pagination, and is printed as page. The problem is that I need to implement the facebook comment plugin, and I need that every page listed by the pagination, to have a unique url, I thought that it could be the same as the node url.

I tried by doing something with panes, but I could't override the View page. I'm Using Drupal 7 and the lasted version of views.

Thanks


texts: Custom field with a custom entity reference

texts:
I have a custom content type 'project' with a title 'project_no'.
I am creating a custom field 'project_reference' to be used in other content types. It has few fields; one of them is an entity reference to 'project'.
I have this in my FieldType . php file:
$properties['project_no'] = DataDefinition::create('entity_reference')
  ->setLabel(t('Project No.'))
  ->setSetting('target_type','project')
  ->setSetting('handler','default');

how to display the widget as a drop list and to have it use auto complete to search/filter in contents of 'project'?
I want to be able to enter a character and it will filter the projects that contain that character.


texts: (OG) Example function to detect User's roles?

texts:
Using Open Atrium 6.x-1.2 (Organic Groups 6.x-2.3 inc it's access control.mod), would someone be as kind to provide an example function that would detect the current user's role? It's my understanding OG overrides the standard Drupal permissions page. My end goal is to allow certain roles access to groups they don't specifically have membership (eg: Executive) for a custom OA/OG access control policy/module.

Would some implementation of Rules be possible here?

My skill level: no PHP but just started studying module dev


texts: How can I use different database backend for certain tables?

texts:
What do I need to do in order to serve config entities from Mongo and cache from Redis database backends?

So basically:
a) how do I tell Drupal that I want to use different db backend for certain tables?
b) what is needed in regard to drivers for those database backends? Are they available?

This is similar to How can I save/load my Entity from a different database in Drupal 8? but in this case I am interested in entirely different db backend + I want to include also non-entity tables so that annotation approach is not working for me.


texts: Programatically linking an image to content (Drupal 7)

texts:
When I create a block through views I can easily link it to the content page by setting link image to in the field's settings.  But I also have some blocks that are created programmatically and I would like to similarly add links to these images.  How would I do this?

EDIT: Here is the code I use to create the block:

  $block = array();
  $rows = array();
  $format = 'l, F j, Y  - G:i';

  $header = array('Project Name', 'Screenshot' , 'Submitted');
  foreach ($results['node'] as $nid_array) {
    $row = $nid_array->nid;
    $node = node_load($row);
    $path = $node->field_icon_thumbnail['und'][0]['uri'];
      $variables = array(
    'path' =>  image_style_url('icon_thumbnail',$path),
    'alt' => 'Thumbnail',
    'title' => 'Thumbnail',
    'attributes' => array('class' => 'some-img', 'id' => 'my-img'),
    );
      $image = theme('image', $variables);

      $rows[] = array(
    l($node->title, "node/$node->nid"),
    $image,
    date($format, $node->changed)
      );
  }
  $rows = array_reverse($rows);
  $table = array('rows' => $rows, 'header' => $header, 'empty' => 'No terms found');
  $block['content'] = array(
  '#theme' => 'table',
  '#header' => $header,
  '#rows' => $rows,
  '#empty' => t('No terms found')
  );
  return $block;


texts:
I have a drupal commerce form and I'd like it to send me an email with all the data from the form the user filled out every time they submit the form.

Is this possible?


texts:
I am trying to add my own image menu names (I prepared png files) instead of menu titles (Navigate, Category, Home etc.). How can I do this? Which files should I need to check? I know Html Menu module but it does not work on menu titles.

Thank you.


texts: How to allow users to rotate a picture upon upload?

texts:
On my site, users are able to upload images one at a time as nodes of content type Picture.  The Picture content type uses the core (D7) image field.

Some of my users have pictures which are taken such that they need to be rotated 90 or 180 degrees.  These users do not have easy access to image editing software, so I'd like to allow users to rotate the image on the edit node screen.

After the image is saved, I want to apply an image style (that forces scaling and cropping, etc.)  I'm also using the Manual Crop module to allow users to crop the image if necessary.

Is there a module for this, or some easy way to do it in code?  (I'm not a developer.)

I would prefer to have a solution where I can present users with a button to rotate the picture; I don't want to give them a full image editor.

If such a solution is impossible, is there an easy way to rotate the images on the back end (for admins)?  I'm happy to do it myself, as I have to check all the images anyway.


texts: How to get the human readable content type name in a node template

texts:
I have created node template for my node, and its working fine.

I need to print content type name, which is like "Whitepaper" and has machine name "w1" in my node template. If I use variable {{ node.bundle }}, its printing the machine name. But I need the human readable name.

I tried many elements of node, content and page variables but I'm not able to print the human readable content type name.

Can anybody help?


texts: How add additional css classes to description field in webform component?

texts:
I want to add additional CSS classes to webform component description field.

in default mode, this item is wrapped inside a div element with "description" class like below:

here is description text

Now I want to add extra CSS classes beside description.

How can I do this? via a module and form alter operation or via theme functions hook?

Please guide me.


texts: Commerce add to cart form fails when loaded via Ajax

texts:
Edit: more details below

I'm setting up a store page as follows, using Views, Commerce, and Drupal AJAX via a custom module:

There is a View that lists product display Nodes (B). Clicking on a Node in the View loads that Node's 'full' view on the page via AJAX (C), which includes the Product reference field / add to cart form (D). There are also AJAX links (A) that will swap the View for another display of the same view (with different criteria for loading the Nodes). The add to cart button works on Nodes included in the View display that loads initially on the page, but not if the View display is switched. When clicked, the form submits, but the product is never added to the cart. No errors or log messages. The exception is that any product Nodes that were loaded in the initial View display will work in subsequent ones.

So if 'new_releases' is the Views display loaded during the initial page load, and it includes 'title 1', then when 'title 1' is loaded, then the 'buy' button works. If 'full_catalog' is then loaded, then 'title 1' is loaded, then the 'buy' button works. But if 'full_catalog' includes 'title X', not included in 'new_releases', then they 'buy' button won't work when 'title X' is loaded.

This makes me think something is going on (perhaps with form_token or form_build_id) that gets initialized properly during the first page load that doesn't happen via subsequent AJAX loads, but I'm not sure what that would be. The form HTML seems to be correct in both cases, both include the product ID and hidden quantity fields. No error messages shown.

Here's my code that loads the node:

function my_module_node_loader($nid = 0) {
 $node = node_load($nid, NULL, false);

 if($node) {
   $nodeview = node_view($node,'full');
   return render($nodeview); //will be returned in my_module_ajax_callback via drupal_json_output
 }

}

The function that retrieves the view:

function my_module_store_contents($display) {

 $view = views_get_view('view_name');
 $view->set_display($display);
 $view->execute();
 $response = $view->result;

 foreach($response as $id=>$row) {
   //do some custom formatting, put the results in $html
 }

  return $html; //returned via my_module_block_view on intial page load, my_module_ajax_callback subsequently

}

I'm already sure the AJAX callbacks are working ok, as the content gets loaded as I'd expect. It's just the issue with the form. Is there an extra step to make sure that a form is initialized properly if loaded via AJAX?

Edit:

Thanks to a tip on drupal commerce's site, I discovered the cause of this was my altering the form's #action, which I had forgotten about. The add-to-cart form seems to take its #action from the path that loads it, so rather my /shop url, it was trying to load the /my-module/ajax callback. Since the add-to-cart form isn't itself ajax-enabled, it was redirecting the page with that url rather than doing it via ajax - I'd get the JSON response - so I was attempting to set the #action back to /shop:

    function my_module_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state) {

     if(substr($form['#action'],0,15) == '/my-module/ajax') {
       $form['#action'] = '/shop';
       $form_state['rebuild'] = TRUE;
     }
   }

I attempted to use the 'rebuild' directive, with no effect. But if I remove the code altering the #action, then the product is added to the cart, albeit first sending me to /my-module/ajax.

So I need to either alter the add-to-cart form to submit properly via ajax, or figure out how I can alter the #action without breaking the form.


texts: How to include a PHP web file into the content region. from a module

texts:
I am new to Drupal and PHP. I am trying to create a module that when activated creates a page, then creates a block, configures block to only show on the created page, and then display an included PHP file. The PHP file that is included is for accessing an off site database.

I have managed to code the module to create the page, and create the block. But the following is my issue.

In the hook_block_view, for content I have input a function name, below I defined the function to include testpage.inc. that page loads but the content does not load in the block's specified region. If I just input text for the content, it loads in the region no problem.

<?php

//////////////////////////////////////////////////////////////////
/** using hook_menu to create a page for the module - hook_menu**/
/////////////////////////////////////////////////////////////////
function sps_webconnect_menu() {
  $items['products']=array(
      'title' => 'Products',
      'type' => MENU_NORMAL_ITEM,
      'page callback' => 'sps_webconnect_products',
      'access callback' => TRUE,
      );
  return $items;
}

/** This function defines the page callback from above**/
function sps_webconnect_products() {
  return "&nbsp";
}

////////////////////////////////////////////////////////////////
/** Creates and Defines Block - hook_block_info**/
////////////////////////////////////////////////////////////////
function sps_webconnect_block_info() {
  $blocks['sps_webconnect_block'] = array(
      'info' => t('Products Page - SPS Web Connect'),
      'cache' => DRUPAL_NO_CACHE,
      'status' => TRUE,
      'region' => 'content',
      'visibility' => BLOCK_VISIBILITY_LISTED,
      'pages' => 'products',
  );
  return $blocks;
}

//////////////////////////////////////////////////////////////////////
/* This function defines the content of the block - hook_block_view */
/////////////////////////////////////////////////////////////////////
function sps_webconnect_block_view($delta = '') {
  $block = array();

  switch ($delta) {
    case 'sps_webconnect_block':
      $block['subject'] = t('SPS Product Page');
      $block['content'] = sps_webconnect_file();
      break;
  }
  return $block;
}

function sps_webconnect_file(){
  $output = '';
  module_load_include('inc', 'sps_webconnect', 'testpage');
  return $output;
}


texts: Manager of groups stopped appearing as member and groups stopped appearing in her "my groups" list

texts:
I'm utterly befuddled.

I'm in the process of building a site (D7) that is group-based. I have a few users on the site right now as I develop it and try to work out bugs. One of my users had created several groups, joined a couple others, and everything worked fine until sometime between yesterday and today. Suddenly, the groups she started (and is therefore manager of) stopped showing in her list of groups she is a member of. At the same time, she lost non-manager memberships of all groups but one, and then whenever she added a group it removed the prior one.

I had (and continue to have) the number of groups someone can join set to unlimited. I've also gotten it so she can be a member of more than one group again. However, groups she's a manager of still don't appear on her list, and her name doesn't appear on the members list on those group pages. When she views the groups she's manager of, it does say "You are the group manager." That relationship doesn't seem to appear anywhere else, though.

To further add to the confusion, on my non-admin account on the site I am manager on one group and member of another. I never lost visibility of my group I manage, and it never lost visibility of me. This seems to have affected only her account.

I'm at a loss to figure out what happened and how to solve it. I did back up the db yesterday morning (before whatever broke this happened), although I've had 2 new users and have made other adjustments since then. Can I compare her uid in the two databases and manually correct differences? Where would I look to set elements of group membership/management? Is there an easier way to do this just through Drupal admin interface?